![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Anyone could help me with this category problem? [Thread Next] Re: Anyone could help me with this category problem?To: NULL Date: 3/1/2005 4:44:00 PM Tempore 23:03:36, die Monday 28 February 2005 AD, hinc in foro {comp.text.xml} scripsit Li Ming <rainbow_6@e...>:
> Because <category> element appears before <welcome> element, so it is
> matched first and displayed before <welcome>. Can I display it in the order
> that I like, just as the output above, without modifying the layout of the
> xml document (even the element order)? Thank you.
Yes, no problem at all.
Give this a try:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<xsl:key name="discByCat" match="cdshelf/disc" use="@cg"/>
<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:for-each select="ancestor::shop/category/cd">
<h3><xsl:apply-templates/>:</h3>
<ol>
<xsl:apply-templates select="key('discByCat',@type)"/>
</ol>
</xsl:for-each>
</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)
"Et ipsa scientia potestas est" - Francis Bacon , Meditationes sacrae
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
