Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Display by category...

From: "Joris Gillis" <roac@-------.-->
To: NULL
Date: 3/2/2005 6:17:00 PM
Tempore 09:16:52, die Wednesday 02 March 2005 AD, hinc in foro {comp.text.xml} scripsit Zhou Lei <dark_eaglet@h...>:

> The XML file contains 2 locations, and each location has different kinds of CDs
> available (some are unavailable, for example, classical CDs are absent at
> location "Address"). And the correct CDs should appear according to
> its location and the category should be listed in ascendent order. Is it
> possible to do it? Thank you.
>
Once again, no problem:)

here's one example, using xpath rather than keys.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />

<xsl:template match="category"/>

<xsl:template match="welcome | headline">
	<xsl:element name="h{count(ancestor::*)}">
		<xsl:apply-templates/>
	</xsl:element>
</xsl:template>

<xsl:template match="cdshelf">
	<xsl:variable name="shelf" select="."/>
	<xsl:for-each select="ancestor::shop/category/cd">
		<xsl:sort/>
		<xsl:if test="$shelf/disc[@cg=current()/@type]">
		<h4><xsl:apply-templates/>:</h4>
			<ol>
				<xsl:apply-templates select="$shelf/disc[@cg=current()/@type]"/>
			</ol>
		</xsl:if>
	</xsl:for-each>
</xsl:template>

<xsl:template match="location">
	<h3>Location <xsl:value-of select="@name"/>:</h3>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="disc">
	<li><xsl:value-of select="@name"/></li>
</xsl:template>

</xsl:stylesheet>

regards,
-- 
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Spread the wiki (http://www.wikipedia.org)


transparent
Print
Mail
Like It
Disclaimer
.

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.

.
.

transparent

transparent