[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XHTML table of contents with XSLT

Subject: Re: XHTML table of contents with XSLT
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 23 Feb 2007 17:16:42 GMT
Re:  XHTML table of contents with XSLT
as has been said, you can use {generate-id()} rather than {.} to
generate ids.

Also don't do  
 <xsl:template match="/*[local-name()='html']">
etc, instead add

                 xmlns:h="http://www.w3.org/1999/xhtml"
to your xsl:stylesheet, then you can write that as

 <xsl:template match="/h:html">

and similarly replace

       <xsl:apply-templates select="*[local-name()='body']"/>


by

       <xsl:apply-templates select="h:body"/>

etc.

<!-- A default rule will just copy all the rest -->

<xsl:template match="*">
     <xsl:element name="{name(.)}">
       <xsl:for-each select="@*">
         <xsl:attribute name="{name(.)}">
           <xsl:value-of select="."/>
         </xsl:attribute>
       </xsl:for-each>
       <xsl:apply-templates/>
     </xsl:element>
   </xsl:template>


can be

<!-- A default rule will just copy all the rest -->

<xsl:template match="*">
     <xsl:copy>
         <xsl:copy-of select="@*"/>
       <xsl:apply-templates/>
 </xsl:copy>
   </xsl:template>


David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.