R
Ravi
My XML looks something like:
<one>
....
<two>A</two>
<two>B</two>
<two>C</two>
<two>D</two>
....
</one>
I want to transform this so that the XHTML looks like
Two:
A, B, C, D
If I use
<xsl:template match="two">
Two:<br/><xsl:value-of select="."/>,
</xsl:template>
This would cause
Two:
A,
Two:
B,
Two:
C,
Two:
D,
to be displayed which is not what I want. So my question is whether
there is someway to know what child (in terms of number) a given node is
of its parent i.e. when I see "two" for the first time and last time I
can do one type of transform and another type of transform for all other
occurances of "two" (i.e. not the first and last child (of type "two")
of parent "one").
On a related note is there someway to club together all occurances of
"two" if they are not contiguous i.e if the XML looks like
<one>
....
<two>A</two>
....
<two>B</two>
....
<two>C</two>
....
<two>D</two>
....
</one>
can I still have all the "two" elements clubbed together in the final
display?
What would be a good way to display the elements in a well aligned
manner on a single line (I do not know the number of values in advance
so I cannot create a table)? Basically after each value is printed I
want the next element displayed starting at the next tab (if one exists
on current line) or the first column of the next line.
TIA.
<one>
....
<two>A</two>
<two>B</two>
<two>C</two>
<two>D</two>
....
</one>
I want to transform this so that the XHTML looks like
Two:
A, B, C, D
If I use
<xsl:template match="two">
Two:<br/><xsl:value-of select="."/>,
</xsl:template>
This would cause
Two:
A,
Two:
B,
Two:
C,
Two:
D,
to be displayed which is not what I want. So my question is whether
there is someway to know what child (in terms of number) a given node is
of its parent i.e. when I see "two" for the first time and last time I
can do one type of transform and another type of transform for all other
occurances of "two" (i.e. not the first and last child (of type "two")
of parent "one").
On a related note is there someway to club together all occurances of
"two" if they are not contiguous i.e if the XML looks like
<one>
....
<two>A</two>
....
<two>B</two>
....
<two>C</two>
....
<two>D</two>
....
</one>
can I still have all the "two" elements clubbed together in the final
display?
What would be a good way to display the elements in a well aligned
manner on a single line (I do not know the number of values in advance
so I cannot create a table)? Basically after each value is printed I
want the next element displayed starting at the next tab (if one exists
on current line) or the first column of the next line.
TIA.