Subject: Re: [xsl] Can you pass a parameter from a stylesheet to the resulting HTML file? From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Sat, 01 Jun 2002 01:34:52 +0200 |
<xsl:template match="foo"> <xsl:apply-templates select="bar"> <xsl:with-param name="name-of-param" select="value-of-param"/> </xsl:apply-templates> </xsl:template>
<xsl:template match="bar"> <xsl:param name="name-of-param" select="default-value-of-param"/> <xsl:value-of select="$name-of-param"/> </xsl:template>
<xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template>
<xsl:template match="ol"> <ol start="{count(preceding::ol) + 1}"> <xsl:apply-templates select="node() | @*"/> </ol> </xsl:template>
Hi all,
I sure appreciate everyone's help! The manual I'm working on is going well because of it.
I have a more complicated question. Part of my XHTML file contains a table, simplified below:
<table> <tr> <td> <ol> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ol> </td> </tr>
<tr> <td> <ol start="4"> <li>item 4</li> <li>item 5</li> <li>item 6</li> </ol> </td> </tr> </table>
As you can see, I have a continuous list split across two cells. Even if I don't close the </ol> in the first cell, the numbering starts again at 1 in the next cell unless I use <ol start="4">.
My question is this. I have two different stylesheets transforming the same XHTML file. One stylesheet filters the XHTML file so the number of list items is less; therefore, the <ol> start attribute needs to be different in each transformed file.
I understand that I can declare a parameter in my XSL file thus: <xsl:param name="startnum" select="3"/>
But is there a way to pass that parameter to the <ol> tag's start attribute in the transformed file? I've checked my XSL books and searched on the web, but I can't find a way to do this.
Below is the XSL file I'm using--it's pretty simple.
----------------------xsl file--------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">
<xsl:output method="xml" encoding="UTF-8"/> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> --------------------end xsl file---------------------------
TIA, Kathryn
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Can you pass a parameter from, Grant-Kathryn | Thread | [xsl] speed of loading, Rosa Cheng |
Re: [xsl] SystemId Unknown?, Joerg Heinicke | Date | Re: [xsl] Sum Problem, Joerg Heinicke |
Month |