xsl-list
[Top] [All Lists]

RE: [xsl] creating name value pairs

2007-11-07 16:55:25
Kotes,

Welcome to the list. When asking for advice on an open-ended question
like this, it's most helpful when you can provide a larger, more
extensive example of the input you need to process, and the
corresponding output. Two data points isn't very much for us to glean
patterns from... for all I know about exactly what you're trying to do,
I could recommend:
<Object1 xsl:version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <Node1> a=1^b=2</Node1>
</Object1>
and it'd technically be correct. :P

But I'm guessing that you want something like this.
<Object1 xsl:version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <Node1>
    <xsl:for-each select="//Node[(_at_)name and @value]">
      <xsl:value-of select="concat(@name, '=', @value)"/>
      <xsl:if test="position() != last()">^</xsl:if>
    </xsl:for-each>
  </Node1>
</Object1>

~ Scott


-----Original Message-----
From: kotes mogili [mailto:xsltlist(_at_)gmail(_dot_)com] 
Sent: Wednesday, November 07, 2007 5:45 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] creating name value pairs

Hi,

Can any body suggest how to transform the following xml to xml
transformation. Node elements can increase dynamically.

<Object>

<Node name="a" value="1"/>
<Node name="b" value="2"/>

</Object>

to

<Object1>

<Node1> a=1^b=2</Node1>
</Object1>

Thanks
Venkat

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>