xslt / x-path problem

B

Bart

I'm trying to transform an xml file to another xml file by using xslt.
for every child node, i need to do some transformations, except for the
first one, so I can't use a for-each construction.
Does anyone now the correct x-path expression or another way to work around
this problem?
You can find an example of the xml file below
I also have another question, can give pass an argument to an xslt script?

tia
Bart


<root>
<child>
<!--some tags-->
</child>
<child>
<a></a>
</child>
<child>
<a></a>
</child>
<child>
<a></a>
</child>
.....
 
J

Joris Gillis

Hallo Bart,

Tempore 13:44:57 said:
I'm trying to transform an xml file to another xml file by using xslt.
for every child node, i need to do some transformations, except for the
first one, so I can't use a for-each construction.
Does anyone now the correct x-path expression or another way to work around
this problem?

The problem could be solved with this:

<xsl:for-each select="child[position() &gt; 1]" />

or you could use the push style:
Instead of using for-each, you would then use templates.

<xsl:template match="child">
Some transformation
</xsl:template>

<xsl:template match="root/child[1]"/>

The last template would make sure that the first child is ignored.

regards,
 
B

Bart

Joris Gillis said:
Hallo Bart,

Tempore 13:44:57, die Sunday 04 September 2005 AD, hinc in foro
{comp.text.xml} scripsit Bart said:
I'm trying to transform an xml file to another xml file by using xslt.
for every child node, i need to do some transformations, except for the
first one, so I can't use a for-each construction.
Does anyone now the correct x-path expression or another way to work
around
this problem?

The problem could be solved with this:

<xsl:for-each select="child[position() &gt; 1]" />

or you could use the push style:
Instead of using for-each, you would then use templates.

<xsl:template match="child">
Some transformation
</xsl:template>

<xsl:template match="root/child[1]"/>

The last template would make sure that the first child is ignored.

regards,

Thanks!

Bart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

problem of python whitespace XML dom 0
Help with XSLT 0
XSLT problem 1
XML an identical copy using XSLT 6
sort and numbering - xslt 7
XML to XML using XSLT 1
Sort xml and output xml 10
Comparing Subtrees in XSLT 4

Members online

Forum statistics

Threads
474,001
Messages
2,570,251
Members
46,850
Latest member
Brightrs

Latest Threads

Top