Sorry, this is a long post. Thanks you for your patience.
El 14/10/2011 0:54, Manuel Collado escribió:
> El 13/10/2011 19:37, Martin Honnen escribió:
>> Manuel Collado wrote:
>>
>>> Well, 'ref="xml:space"' is accepted, but for some reason the XML
>>> processing tool (a validating editor) doesn't preserve whitespace of the
>>> affected element if the xml:space attribute is omitted.
>>>
>>> The aforementioned DTD declaration (#FIXED) forces compliant processing
>>> tools to behave as if the xml:space attribute was present, even if
>>> actually omitted.
>>>
>>> Any thought?
>>
>> Does that editor do schema based validation? I think as far as I
>> understand the W3C schema language you should have the right definition.
>> If you tell us which editor you use then maybe other users reading here
>> can help. Or ask on a mailing list or forum dedicated to that editor.
>
> Than you, very much, for your help.
>
> The editor is XXE from XmlMind. Of course, it validates based on schemas
> (or DTDs, or RNGs, which are converted to schemas on the fly). I believe
> it uses Xerxes to parse documents (and their schemas) when loaded.
>
> The schema I'm trying to hack is
> http://www.w3.org/2007/schema-for-xslt20.xsd
>
> The goal is to visually edit a restricted form of XSLT code in which
> literal result text fragments are only allowed inside <xsl:text>
> elements. This restriction should permit XSLT code re-indentation
> without changing its meaning at all.
>
> The weird thing is that XXE recognizes the schema as expected, but
> doesn't associate <xsl:text> elements with their specification (as it
> does with other <xsl:..> elements). This occurs just with the original
> (unmodified) schema-for-xslt20.xsd
>
> There must be a subtle problem somewhere. The XXE forum is certainly the
> next place to ask.
After further attempts (without asking at the XXE forum) it seems that
the problem relies in the schema-for-xslt20.xsd schema. XSLT elements
inside literal result elements are not associated with their
attribute/content schema. It seems that there is no bug in the XXE
editor. This editor behaves correctly when given other (relaxng) schemas
for XSLT documents.
So my next question is:
Is there a way to specify something like
<!ATTLIST xxx xml:space ( preserve ) #FIXED 'preserve'>
in a RNG schema?
IIUC, the non-optional declaration:
(1) <attribute name="space" ns="http://www.w3.org/XML/1998/namespace">
<value type="string">preserve</value>
</attribute>
should do the trick.
I'm working on in a well-known relaxng schema for XSLT:
(
http://www.thaiopensource.com/relaxng/xslt.rng)
When (1) above is inserted for a specific XSLT element (xsl:text), it
conflicts with a global declaration shared by a wide set of XSLT and
literal elements
(2) <zeroOrMore>
<attribute>
<anyName>
<except>
<nsName/>
<nsName ns=""/>
</except>
</anyName>
</attribute>
</zeroOrMore>
and gives an error:
Document Type Error: duplicate attribute "space" from
namespace "http://www.w3.org/XML/1998/namespace"
Well,
- Are there other publicly available RNG schemas for XSLT?
- Is it possible to restrict (2) above to allow xml:* standard
attributes except xml:space in particular?
Thanks in advance.
--
Manuel Collado -
http://lml.ls.fi.upm.es/~mcollado