T
Thomas Wittek
Hi!
Suppose I have to handle documents with the same schema [1] but some
instances use a (proper) namespace and some instances just use the
default (empty) namespace.
Examples:
<doc xmlns="urn:some_ns">
<foo>bar</foo>
</doc>
<doc>
<foo>bar</foo>
</doc>
Currently I have to write each template like this:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:somens="urn:some_ns">
<xsl:template match="foo | somens:foo" />
</xsl:stylesheet>
That's quite tedious to do for each and every XPath selection.
I could imagine a modified identity transformation that changes the
namespace for a given document.
But then I have to run two XLSTs consecutively, whereas I would prefer
to have the transformation in *one* file.
So is there any possibilty to normalize the namespace of the input
document instead of preprocessing it with another XSLT? Or override the
default namespace of the input doc?
Thank you for any ideas!
[1] Or at least the same structure.
Obviously the doc without the namespace cannot use the same
"XML Schema" becaus it's not in the correct namespace.
Suppose I have to handle documents with the same schema [1] but some
instances use a (proper) namespace and some instances just use the
default (empty) namespace.
Examples:
<doc xmlns="urn:some_ns">
<foo>bar</foo>
</doc>
<doc>
<foo>bar</foo>
</doc>
Currently I have to write each template like this:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:somens="urn:some_ns">
<xsl:template match="foo | somens:foo" />
</xsl:stylesheet>
That's quite tedious to do for each and every XPath selection.
I could imagine a modified identity transformation that changes the
namespace for a given document.
But then I have to run two XLSTs consecutively, whereas I would prefer
to have the transformation in *one* file.
So is there any possibilty to normalize the namespace of the input
document instead of preprocessing it with another XSLT? Or override the
default namespace of the input doc?
Thank you for any ideas!
[1] Or at least the same structure.
Obviously the doc without the namespace cannot use the same
"XML Schema" becaus it's not in the correct namespace.