473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

xslt / x-path problem

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>
.....
Sep 4 '05 #1
2 1173
Hallo Bart,

Tempore 13:44:57, die Sunday 04 September 2005 AD, hinc in foro {comp.text.xml} scripsit Bart <or****@pandora.be>:
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,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant
Sep 4 '05 #2

"Joris Gillis" <ro**@pandora.be> schreef in bericht
news:op***************@news.pandora.be...
Hallo Bart,

Tempore 13:44:57, die Sunday 04 September 2005 AD, hinc in foro
{comp.text.xml} scripsit Bart <or****@pandora.be>:
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
Sep 4 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
5
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT)...
0
by: Christopher M. Lauer | last post by:
I have done my best to answer this question but can not find the proper set of commands. I would like to transform an xml file (in code behind) and display its output in a specific html tag,...
4
by: schneider | last post by:
Anyone know if there is a way to dynamicly create a Xslt template/s and use them as an xml transform with-out use files for the Xslt? All the methods I see use files. I want to create a Xslt...
3
by: Teksure | last post by:
Hi group, searching in the Internet I found two products for XML which incorporate a very robust debugger for XSL/XSLT, I would like you to see these products and then, give me your opinion about...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.