XSLT and concat curiosity


XML & Web services: XSLT and concat curiosity

  1. XSLT and concat curiosity (1 messages)

    We have an xml viz. .... .... .... .... .... The number of events will be dynamic. For a relevant component,we need to return the cooresponding events pipe-delimited. We arrive at the particular component through SelectNodes - is there a smart,concide XPATH expression which can allow me to return the set of events in the way we want,rather than recursing through the set. Note that component and event nodes are parent(ed) by 'element'. We are using javascript.

    Threaded Messages (1)

  2. Recursing?[ Go to top ]

    Do you really mean recursing? You could use recursion, but it would make more sense to me to just do a "for-each" loop. Do it inside a variable definition, and for each event, generate a pipe followed by the content from the event element. Then return the substring of the variable that starts at position 2 (to get rid of the opening pipe). In XSLT 2.0, it's even easier, just use the 'string-join' function: http://www.w3.org/TR/xpath-functions/#func-string-join Cheers, Tony. -- Author, XML APIs chapter Advanced XML Applications from the Experts at The XML Guild http://www.amazon.com/XML-Power-Comprehensive-Guide-Guides/dp/1598632140/