In an XSLT stylesheet, I have set xpath-default-namespace
to match the input document that the stylesheet processes. The output document is in the no namespace.
For example, the xsl:stylesheet element has xpath-default-namespace specified:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://my.example.com/"
>
Within the transform, I am building elements with no namespace, and I need to match on these elements as well. For now, I use constructs such as:
<xsl:variable name="vCustomElement" as="element()">
<some_element>
<!-- element content -->
</some_element>
</xsl:variable>
<xsl:apply-templates select="$vCustomElement" mode="something" />
.
.
<xsl:template match="*:some_element" mode="something">
...
<xsl:sequence select="." />
...
</xsl:template>
This works, but I am curious, is there a way for me to specify no namespace as a prefix in an xpath expression? The above only works, as its matching all namesapces including the no namespace