|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I have an XML output file...
i want to apply a different transformation to a node if it is the first node that contains a child node with a particular value... The data is sorted by that particular child node ie. if i had Code:
<record> <class>Important</class> </record> <record> <class>Important</class> </record> <record> <class>For Review</class </record> i would want the first "Important" Record to be transformed differently, as well as the "For Review" basically i need to compare the class child of the current record with that of the previous' but i have no clue how! Any help would be much appreciated! |
|
#2
|
||||
|
||||
|
You can use XPath to achieve this w/o doing a loop and comparing.
Code:
select="record[1]/class" // first one select="record[count(record)]/class" // last one
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#3
|
|||
|
|||
|
Quote:
i tried and tried but i could not get this to work, it would only highlight the first entry, am i missing something? |
|
#4
|
||||
|
||||
|
Sorry. I came up with that off the top of my head and I too am still learning all this X* stuff. This should work (I actually tested it this time).
Code:
select="record[last()]/class" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > simple XSL question? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|