Subject: Re: [xsl] [XSL]Display Different Results Based on Count of NodeSets From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx> Date: Mon, 24 Sep 2007 08:24:40 -0400 |
This is what I got for the output (I am actually using XSLT to transform into HTML, so the XML, is the input as shown below:
<author>Tennison, Jeni <title>Beginning XSLT <publisher>Wrox</publisher> <publication>2002</publication> </title> <title>Beginning XSLT 2.0</title> </author>
<author>Meyer, Eric <title>The Zen of CSS</title> <publication>2005</publication> </author>
The output, oddly, when I used <xsl:value of select="count(title)"/> instead of position() it produced 2 and 1, respectively, but when the <xsl:apply-templates was inserted, it generates output of
<div><p>Tennison, Jeni.</p> <p><i>Beginning XSLT</i>. <b>Wrox</b>, [2002].</p> <p><i>Begining XSLT 2.0</i>.</p></div>
<div><p>Meyer, Eric.</p> <p><i>The Zen of CSS</i>.</p> </div>
<xsl:template match="title"> <xsl:choose> <xsl:when test="position() ='1'"/> <xsl:otherwise> <p> <xsl:apply-templates/>
</p> </xsl:otherwise> </xsl:choose> </xsl:template>
<xsl:template match="publication"> [<xsl:value-of select="."/>]. </xsl:template>
<xsl:template match="publisher"> <b><xsl:value-of select="."/></b>. </xsl:template>
It brings back the same input. However, I wanted the one on the first of the <title> to be something like:
<div><p>Tennison, Jeni. <i>Beginning XSLT</i>.<b>Wrox</b>, [2002].</p> <p><i>Begining XSLT 2.0</i>.</p></div>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [XSL]Display Different Re, David Carlisle | Thread | [xsl] Checking alphabetical order, Kamal Bhatt |
Re: [xsl] Getting dropped tags..., Buddhi Dananjaya | Date | Re: [xsl] Getting dropped tags..., David Carlisle |
Month |