[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to get a multiple TOC HTMLs from Map2HTMTOC.xsl

Subject: Re: [xsl] How to get a multiple TOC HTMLs from Map2HTMTOC.xsl
From: Matthieu Ricaud-Dussarget <matthieu.ricaud@xxxxxxxxx>
Date: Tue, 17 Jul 2012 17:12:57 +0200

Hi Ray,

I'm not sure I can clearly understand what you want to do from your big sample.
The relevant part is just :
<xsl:template name="generate-toc">
do somethings ...
isn't it ?

Anyway form what I understand you want to output multiple files : with XSLT2 you can use many <xsl:result-document> with differents @href.

How many <xsl:result-document> you use and how to make then be applied can depend on xml input (is the information there?), hard code in the XSLT, given as param to the transformation, etc.
Using mode for each <xsl:result-document> is a good idea. Think that you can also use mode="#all" or mode="mode1 mode2" if there are templates that should be the same.

By the way, instead of formating the output with <xsl:value-of select="$newline"/>, I suggest you use <xsl:output> with good attributes (@indent="yes|no", @method="xml|text|xhtml").

Hope this helps,


Le 17/07/2012 16:40, team wise a C)crit :
Dear list readers,

I have a style sheet called map2htmtoc.XSL stylesheet written in XSLT
1.0, if I need to apply lines of code snippet as follows to generate a
couple of different 'TOC's as HTML,
how to achieve that?

<xsl:template name="generate-toc">
   <html><xsl:value-of select="$newline"/>
   <head><xsl:value-of select="$newline"/>
     <xsl:if test="string-length($contenttarget)>0 and
       <base target="{$contenttarget}"/>
       <xsl:value-of select="$newline"/>
     <!-- initial meta information -->
     <xsl:call-template name="generateCharset"/>   <!-- Set the
character set to UTF-8 -->
     <xsl:call-template name="generateDefaultCopyright"/> <!-- Generate
a default copyright, if needed -->
     <xsl:call-template name="generateDefaultMeta"/> <!-- Standard meta
for security, robots, etc -->
     <xsl:call-template name="copyright"/>         <!-- Generate
copyright, if specified manually -->
     <xsl:call-template name="generateCssLinks"/>  <!-- Generate links
to CSS files -->
     <xsl:call-template name="generateMapTitle"/> <!-- Generate the
<title> element -->
     <xsl:call-template name="gen-user-head" />    <!-- include user's
XSL HEAD processing here -->
     <xsl:call-template name="gen-user-scripts" /> <!-- include user's
XSL javascripts here -->
     <xsl:call-template name="gen-user-styles" />  <!-- include user's
XSL style element and content here -->
   </head><xsl:value-of select="$newline"/>


<div class="container top">

<div class="header">


<span class="logo">

<xsl:element name="img">

<xsl:attribute name="src">../images/logo.png</xsl:attribute>

<xsl:attribute name="alt">SOY</xsl:attribute>



<a href="index.html" class="title">Help</a></h1>

<div class="nav">

<xsl:apply-templates select="." mode="generate-dynamic-toc"/>



<div class="section">


<span class="category-name">App</span>

<span class="model-name">"" Application</span>



<div class="main-visual">

<div class="banner">

<xsl:element name="img">

<xsl:attribute name="src">../images/p_cover.png</xsl:attribute>

<xsl:attribute name="alt"></xsl:attribute>




<div class="information pattern2">

<p>This manual used as you have some trouble or you do not know how to
use the "" Application.<br />

<a href="contents/t0900_trademark.html">Trademarks</a>



<div class="return-pagetop">

<a href="#top">

<xsl:element name="img">


<xsl:attribute name="alt"></xsl:attribute>

</xsl:element>Go to Page Top




<div class="footer">

<div class="copyright">2012</div>



<xsl:if test="string-length($OUTPUTCLASS) &gt; 0">
        <xsl:attribute name="class">
          <xsl:value-of select="$OUTPUTCLASS"/>
      <xsl:value-of select="$newline"/>
    </body><xsl:value-of select="$newline"/>

At this point of time, I could implement a variety of  apply-templates
in different modes, subject to conditions, for example,

<xsl:apply-templates select="." mode="generate-dynamic-toc"/>

<xsl:apply-templates select="." mode="generate-dynamic-toc2"/>

<xsl:apply-templates select="." mode="generate-dynamic-toc3"/>

<xsl:apply-templates select="." mode="generate-dynamic-toc4 "/> ,etc,
the current template applys a XSL document instruction to get just one
TOC HTML file.

<xsl:document href="{$OUTPUTDIR}\{$transformedLngValue}\toc.html">

if I need to get mutiple TOC*.html, what is the right syntax? Does
removing the document instruction make a diferenece?

I greatly appreciate if anyone out there can share your thoughts.


Matthieu Ricaud
05 45 37 08 90
IGS-CP, service livres numC)riques

Current Thread