 |
 |
 |
with what you have described, it looks to me that you would want to group
the names with quarter-names.. The following grouping method would help you.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="name" match="/root/enrolledClasses/class" use="quarterName"/>
<xsl:template match="/">
<xsl:for-each select="/root/enrolledClasses/class[not(quarterName =
preceding-sibling::class/quarterName)]">
<i><xsl:value-of select="quarterName"/></i><br/>
<xsl:for-each select = "key('name',quarterName)">
<xsl:value-of select="name"/><br/>
</xsl:for-each>
<hr/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
HTH
Vasu
From: "Ryan O'Leary" <ryan-portal@xxxxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] Checking value of a previous text node
Date: Thu, 27 Jun 2002 20:48:20 -0700
Hi all. I've been having a lot of trouble trying to get this to work,
although I'm sure theres a simple answer. I have the following XML:
=== START XML ===
<?xml version="1.0" encoding="UTF-8"?>
<root>
<enrolledClasses>
<class>
<name>Behavior Disorders</name>
<quarterName>Fall 2001</quarterName>
</class>
<class>
<name>ADDITIONAL ENGR LAB</name>
<quarterName>Summer 2002</quarterName>
</class>
<class>
<name>SENIOR PROJECT</name>
<quarterName>Summer 2002</quarterName>
</class>
<class>
<name>C and UNIX</name>
<quarterName>Spring 2002</quarterName>
</class>
</enrolledClasses>
</root>
===== END XML ======
And I would like to produce the following HTML:
===== START HTML =====
<i>Fall 2001</i><br />
Behavior Disorders <br />
<p>
<i>Summer 2002</i><br />
ADDITIONAL ENGR LAB<br />
SENIOR PROJECT<br />
<p>
<i>Spring 2002</i><br />
C and UNIX<br />
<p>
===== END HTML =====
I am having problems writing XSL that will recognize when the
quarterName value has changed and display the quarter only then. I've
tried all kinds of stuff, but I haven't gotten it to work. As a side
note, I can't rewrite the XML to group the classes by quarter because of
the way the XML gets populated.
If anyone could help me with some code that checks the current value of
quarterName against the last value to see if its changed, that would be
awesome!!
Thanks in advance.
- Ryan O'Leary
- ryan-portal@xxxxxxxxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |