|
Subject: Re: [xsl] Making an FAQ page from XML From: Kamal Bhatt <kbhatt@xxxxxxxxx> Date: Tue, 13 Feb 2007 09:09:48 +1100 |
No difference. This is how the relevant template looks now. So grateful for this hlp btw, I really am getting a feel for the power xsl give and want to use all this in my future projects!Can you try again? I tried that on Saxon8 and it works. Here is the output (pretty printed for your viewing pleasure)
<xsl:template match='faqlist'> <xsl:apply-templates select="*[local-name() != 'faq']"/> <xsl:apply-templates select="faq" mode="question"/> <xsl:apply-templates select="faq" mode="answer"/> </xsl:template>
<?xml version="1.0" encoding="UTF-8"?> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">1</td> <td class="mText" style="font-size: 11px"> <a href="#1">Question One?</a> </td> </tr> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">2</td> <td class="mText" style="font-size: 11px"> <a href="#1">Question Two?</a> </td> </tr> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">3</td> <td class="mText" style="font-size: 11px"> <a href="#1">Question Three?</a> </td> </tr> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">1</td> <td class="mText" style="font-size: 11px"> <a href="#1">Answer One</a> </td> </tr> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">2</td> <td class="mText" style="font-size: 11px"> <a href="#1">Answer Two.</a> </td> </tr> <tr> <td valign="top" width="24" class="mText" style="font-size: 11px">3</td> <td class="mText" style="font-size: 11px"> <a href="#1">Answer Three.</a> </td> </tr>
<xsl:template match='faqlist'> <xsl:apply-templates select="*[local-name() != 'faq']" /> <xsl:apply-templates select="faq" mode="question" /> <xsl:apply-templates select="faq" mode="answer" /> </xsl:template>
<xsl:template match='faq' mode="question">
<tr>
<td valign='top' width='24' class="mText" style="font-size: 11px">
<xsl:value-of select="count(preceding-sibling::*) + 1" />
</td>
<td class="mText" style="font-size: 11px">
<a href='#1'>
<xsl:value-of select='q' />
</a>
</td>
</tr>
</xsl:template> <xsl:template match='faq' mode="answer">
<tr>
<td valign='top' width='24' class="mText" style="font-size: 11px">
<xsl:value-of select="count(preceding-sibling::*) + 1" />
</td>
<td class="mText" style="font-size: 11px">
<a href="#1">
<xsl:value-of select='a' />
</a>
</td>
</tr>
</xsl:template> <xsl:template match='*|@*'>
<xsl:copy>
<xsl:apply-templates select='node()|@*' />
</xsl:copy>
</xsl:template>-- Kamal Bhatt
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Making an FAQ page from X, John Steel | Thread | Re: [xsl] Making an FAQ page from X, John Steel |
| Re: [xsl] Making an FAQ page from X, John Steel | Date | Re: [xsl] Making an FAQ page from X, John Steel |
| Month |