 |
 |
 |
xsl-list-digest-help@xxxxxxxxxxxxxxxxxxxxxx wrote:
Why don't you just nest the loops instead of putting them adjacent to each other?
Consider this little stysheet (change 'root' to a proper name) :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:key name="occupant" match="occupant" use="unitid"/>
<xsl:template match="root">
<xsl:for-each select="unit">
<xsl:variable name="unit" select="."/>
<xsl:variable name="occupants" select="key('occupant',id)"/>
<xsl:choose>
<xsl:when test="$occupants">
<xsl:for-each select="$occupants">
<xsl:value-of select="$unit/name"/> | <xsl:value-of select="name"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$unit/name"/> | Vacant
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I had something like this (without using keys, as I just don't
understand keys well enough other than to copy other people's examples
:) ); the problem is that I was giving a simplified version of my
problem. There are actually 7 or 8 columns per row, and it just seems
that there must be a way that I don't have to have each column defined
in both the when and the otherwise.
--Russell
|
 | 

|  |
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.
|  |
| |
 |
 |
 |