xsl-list
[Top] [All Lists]

Re: [xsl] XHTML table of contents with XSLT

2007-02-23 10:17:03

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>