namespace conflict
Posted: Thu Feb 14, 2019 11:50 am
Beginner's confusion about the namespace of an XML and perhaps of an XSLT. This post overlaps with several previous posts, but I couldn't be sure I'd found the appropriate fix in them. Apologies if already answered.
I have a set of XML files which reference an XSLT file and a Relax NG schema, as follows, and which validate fine:
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="../style/HAM_stylesheet.xsl"?><?xml-model href="HAM_TEI_schema.rnc" type="application/relax-ng-compact-syntax"?><TEI xmlns="http://www.tei-c.org/ns/1.0">
The XSLT and the schema each also separately validate. The XSLT has this, and none of the elements in its body have prefixes:
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html"/>
Whether the Relax NG schema is created with a prefix set for pattern names or without one seems to make no difference whatsoever when editing the XMLs in Oxygen. I don't understand this, but it isn't currently a problem.
My problem is this. When the XMLs are processed to HTML, the XSLT fails to take any data from the specific XML. But add quite literally any prefix at all to the XML's namespace, e.g. <TEI xmlns:RUBBISH="http://www.tei-c.org/ns/1.0">, and the processing works perfectly and fully populates the display. So we have the minor inconvenience of having to add a prefix to each XML for uploading but subtract it again for further editing. Is there a one-off fix that would allow an XML to be used in the same form both in Oxygen and on our website (which I'm sure is the normal situation)? And if so, do I really have to go through the whole XSLT adding a prefix to every element? I don't want to embark on that unless I know for sure that (i) it will work, and (ii) it's really necessary. Finally, what then would be the correct way to create the schema: with or without prefix? Thanks.
David
I have a set of XML files which reference an XSLT file and a Relax NG schema, as follows, and which validate fine:
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="../style/HAM_stylesheet.xsl"?><?xml-model href="HAM_TEI_schema.rnc" type="application/relax-ng-compact-syntax"?><TEI xmlns="http://www.tei-c.org/ns/1.0">
The XSLT and the schema each also separately validate. The XSLT has this, and none of the elements in its body have prefixes:
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html"/>
Whether the Relax NG schema is created with a prefix set for pattern names or without one seems to make no difference whatsoever when editing the XMLs in Oxygen. I don't understand this, but it isn't currently a problem.
My problem is this. When the XMLs are processed to HTML, the XSLT fails to take any data from the specific XML. But add quite literally any prefix at all to the XML's namespace, e.g. <TEI xmlns:RUBBISH="http://www.tei-c.org/ns/1.0">, and the processing works perfectly and fully populates the display. So we have the minor inconvenience of having to add a prefix to each XML for uploading but subtract it again for further editing. Is there a one-off fix that would allow an XML to be used in the same form both in Oxygen and on our website (which I'm sure is the normal situation)? And if so, do I really have to go through the whole XSLT adding a prefix to every element? I don't want to embark on that unless I know for sure that (i) it will work, and (ii) it's really necessary. Finally, what then would be the correct way to create the schema: with or without prefix? Thanks.
David