concatenationxslt-1.0xpath-1.0msxml6

Why does this XSLT/XPath Concat returns a 'Nodetest expected here' error using MSXMLDom?


My XML (snip):

    <way id="1237072661">
      <nd ref="11488882051"/>
      <nd ref="11488882048"/>
      <tag k="railway" v="station"/>
    </way>

This XSLT/XPath returns a 'Nodetest expected here' error for the concat command when run using transformNode in MSXML6.

<xsl:copy-of select="*[tag[@k='railway'][@v='station']]/concat('&#xa;',name(),'/',@id)"/>

Without the concat it returns valid data.

It works as expected if parsed using Saxon HE (XPath2?).


Solution

  • XPath 1.0 does not allow the use of functions in location paths (other than in predicates).

    Try something like:

    <xsl:for-each select="*[tag[@k='railway'][@v='station']]">
        <xsl:value-of select="concat('&#xa;',name(),'/',@id)" />
    </xsl:for-each>
    

    instead.