xslt-quality icon indicating copy to clipboard operation
xslt-quality copied to clipboard

Check namespace on fn:transform map

Open mricaud opened this issue 5 years ago • 0 comments

From @arithmeticus on slack xml.com:

Lesson learned. If building a map for fn:transform() , as a habit put an xmlns="[target XSLT default XPath namespace]" in the appropriate xsl:map-entry, e.g., <xsl:map-entry key="'static-params'" xmlns=""> xsl:map <xsl:map-entry key="xs:QName('diagnostics-on')" select="true()"/> </xsl:map> </xsl:map-entry> (Heck, put it at the topmost xsl:map.) If you don't and if you're working in an XSLT file whose default namespace is bound to something else (e.g., HTML), that default NS will get attached to any unprefixed result of xs:QName() . Good chance your parameter bindings will be ignored. One more test worth adding to one's Schematron XSLT checker. (Note, the target default XPath namespace, /*/@xpath-default-namespace should not be confused with the target default namespace xmlns="...".)

mricaud avatar Oct 12 '20 21:10 mricaud