English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have an XML source where the same track appears more the ones. What would I write in my XSLT code, so it doesn't look for 1st but 4th track? And this without changing the XML code.

2006-10-12 23:13:58 · 3 answers · asked by AAV 1 in Computers & Internet Programming & Design

3 answers

No, you do not have to change your XML file. Using XPATH, you can specify a predicate to retrieve the 4th track.

If you are using the "pull" method, you could retrieve the 4th track like this:


If you are using the "push" method and applying templates, you could use this template:




Since you did not post your XML, the XPATH expression may need to be tweaked slightly. For instance, if each of the "track" elements were children of a "tracks" element, then you would change the expressions to: "tracks/track[4]"

2006-10-15 02:19:49 · answer #1 · answered by madscmhansen3 2 · 0 0

I believe you want something like this.



Your code here


But you may have to add details of the template.

2006-10-13 00:16:41 · answer #2 · answered by AnalProgrammer 7 · 0 0

it's all in the xpath...

this sounds like a homework assignment...

so I'll point you in the correct direction .
it's the brackets that allow you to modify your selection so that you can select less.

2006-10-13 05:35:58 · answer #3 · answered by jake cigar™ is retired 7 · 0 0

fedest.com, questions and answers