DaveF
DaveF

Reputation: 173

How do I use XPath concat within MSXML SelectNodes?

How do I use concat within MSXML SelectNodes?

I having problems implementing concat within MSXML SelectNodes (which I believe is XPath 1))

My XML file:

<osmChange>
  <delete>
      <way id="888222408">
      <nd ref="10824713974"/>
      <tag k="railway" v="station"/>
    </way>
      <node id="438589">
      <tag k="railway" v="platform"/>
    </node>
        <snip...>
  </delete>
</osmChange>

This XPath

selectNodes("(//delete/node|//delete/way)[tag[@k='railway'][@v='station' or @v='rail' or @v='platform']]/@id")

Returns:

<delete>
id="888222408"
id="438589"
</delete>

My desired output is:

<delete>
way/888222408
node/438589
</delete>

Using a similar XPath within a XSL & parsed using Saxon I was able to obtain that output by appending the concat command to the end of the XPath. Some thing like this (except this returns a 'NodeTest expected here' for the concat command)

selectNodes("(//delete/node|//delete/way)[tag[@k='railway'][@v='station' or @v='rail' or @v='platform']]/concat('&#xa;',name(),'/',@id)")

How do I resolve this problem?

Upvotes: 0

Views: 16

Answers (0)

Related Questions