Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.
Bug #5230
closedDifficulty using xsl:xpath-default-namespace in conjunction with the key attribute of xsl:map-entry
100%
Description
Using saxon-js and given this input:
<foo:root xmlns:foo='http://www.example.com'>
<foo:bar>Hello world</foo:bar>
</foo:root>
And this stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://www.example.com">
<xsl:output method="json"/>
<xsl:template match="/">
<xsl:map-entry key="'greeting'" select="string(//bar)"/>
</xsl:template>
</xsl:stylesheet>
I get this output:
{"greeting": "Hello world"}
However, if I attempt to use the same Xpath to select the key instead of the value, as such:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://www.example.com">
<xsl:output method="json"/>
<xsl:template match="/">
<xsl:map-entry key="string(//bar)" select="'greeting'"/>
</xsl:template>
</xsl:stylesheet>
I get an empty string for the key:
{"": "greeting"}
Attempting this same transformation with the saxon processor bundled with oXygen (v 9.9.1.7 at time of writing) produces the output I expect, however:
{"Hello world":"greeting"}
Please register to edit this issue
Also available in: Atom PDF Tracking page