You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by cr...@apache.org on 2002/11/01 03:55:09 UTC
cvs commit: xml-forrest/src/resources/library/xslt faq2document.xsl
crossley 2002/10/31 18:55:09
Modified: src/resources/library/xslt faq2document.xsl
Log:
Handle both "part" and "faq" elements.
Submitted by: Keiron Liddle <ke...@aftexsw.com>
Revision Changes Path
1.4 +29 -4 xml-forrest/src/resources/library/xslt/faq2document.xsl
Index: faq2document.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/library/xslt/faq2document.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- faq2document.xsl 7 Jun 2002 05:35:23 -0000 1.3
+++ faq2document.xsl 1 Nov 2002 02:55:09 -0000 1.4
@@ -15,27 +15,48 @@
<section>
<title>Questions</title>
<ul>
- <xsl:apply-templates select="faq" mode="index"/>
+ <xsl:apply-templates select="faq|part" mode="index"/>
</ul>
</section>
<section>
<title>Answers</title>
- <xsl:apply-templates select="faq"/>
+ <xsl:apply-templates select="faq|part"/>
</section>
</body>
</document>
</xsl:template>
+ <xsl:template match="part" mode="index">
+ <li>
+ <link href="#part-{generate-id()}">
+ <xsl:apply-templates select="title"/>
+ </link>
+ <ul>
+ <xsl:apply-templates select="faq|part" mode="index"/>
+ </ul>
+ </li>
+ </xsl:template>
+
<xsl:template match="faq" mode="index">
<li>
- <link href="#faq-{position()}">
+ <link href="#faq-{generate-id()}">
<xsl:value-of select="question"/>
</link>
</li>
</xsl:template>
+ <xsl:template match="part">
+ <anchor id="part-{generate-id()}"/>
+ <section>
+ <title>
+ <xsl:value-of select="title"/>
+ </title>
+ <xsl:apply-templates select="faq|part"/>
+ </section>
+ </xsl:template>
+
<xsl:template match="faq">
- <anchor id="faq-{position()}"/>
+ <anchor id="faq-{generate-id()}"/>
<section>
<title>
<xsl:value-of select="question"/>
@@ -49,6 +70,10 @@
</xsl:template>
<xsl:template match="answer">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="title">
<xsl:apply-templates/>
</xsl:template>