0

I have a task where I'm transforming a response like this:

<Names>
    <Name>
      <First></First>
      <Last></Last>
      <Middle></Middle>
    </Name>
    <Name>
      <First></First>
      <Last></Last>
      <Middle></Middle>
    </Name>
</Names>

But I have to format it into nodes like this:

<name_first_1></name_first_1>
<name_last_1></name_last_1>
<name_middle_1></name_middle_1>
<name_first_2></name_first_2>
<name_last_2></name_last_2>
<name_middle_2></name_middle_2>

So I wanted to use position() to figure out a way to dynamically change the node name so I could do something like "<name_first_$value>". Am I coming from left field with this? :)


Any help would be greatly appreciated!

Thanks,

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Swijr
0

with which programme / language would like to access you the Xml file.
your beginning is wrong for your idea there is xpath with
<xsl:value-of select="Name[1]/First"/> the first name
<xsl:value-of select="Name[2]/First"/> the second name

so to predicates

0

Wow, the simplest solution evaded me. Thanks for your help!

Steve

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.