Dear Hussein,
Thank you for your suggestion to use templates to insert language attributes
but I would prefer to keep language information separate from the document.
Otherwise I will end up with thousands of attributes with predictable values
in my document, which will needlessly make it a lot bigger.
Now, on a more general level, are default and fixed attributes included in
the internal representation of XML documents in XXE? They seem to be
included in document validation, but I don't think I can access them from
macros and stylesheets, can I?
In Saxon 9.1 (but only when the -dtd:on command line parameter is set), you
can access default/fixed values of attributes using XPath, e.g.:
DTD (fragment)
===
<!ELEMENT Headword (#PCDATA)>
<!ATTLIST Headword lang "fr">
Document (fragment)
=======
...
<Headword>chien</Headword>
...
XSLT (fragment)
====
<xsl:template match="Headword">
<xsl:copy-of select="@lang"/>
<xsl:template>
produces:
fr
as expected.
By comparison, given the same data, the following command in XXE:
<get context="$implicitElement" expression="@lang"/>
returns nothing. It does, though, when the value of the attribute is set
explicitly.
In my opinion, being able to access default/fixed attribute values from
XPath and CSS could prove useful in some scenarios. It would certainly do so
for me. Since this feature seems quite generic (after all this is why
default/fixed attributes were invented in the first place), could you
perhaps consider adding it in a future version of the editor? I understand
that this would depend mostly on the Saxon implementation currently used in
XXE, but if the change doesn't involve a lot of coding and does not cause
major performance penalties, I would appreciate it.
Best wishes,
Mariusz Idzikowski