Subject: [xsl] function last() not matching the last element tag From: Ross Buchanan <ross-buchanan@xxxxxxxxxx> Date: Fri, 26 Jan 2007 10:09:03 -0600 |
[]$ xsltproc --version Using libxml 20616, libxslt 10111 and libexslt 809 xsltproc was compiled against libxml 20614, libxslt 10111 and libexslt 809 libxslt 10111 was compiled against libxml 20614 libexslt 809 was compiled against libxml 20614
Simple XML File: <?xml version="1.0" encoding="utf-8"?> <doc> <p>1 Paragraph 1</p> <p>2 Paragraph 2</p> <p>3 Paragraph 3</p> </doc>
XSLT File: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/doc"> <html><head><title>The Title</title></head><body> <xsl:apply-templates /> </body></html> </xsl:template>
<xsl:template match="/doc/p"> <p class="p"><xsl:value-of select="." /></p> </xsl:template>
<xsl:template match="/doc/p[1]"> <p class="p firstP"><xsl:value-of select="." /></p> </xsl:template>
<xsl:template match="/doc/p[last()]"> <p class="p lastP"><xsl:value-of select="." /></p> </xsl:template>
Output Desired: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>The Title</title> </head> <body> <p class="p firstP">1 Paragraph 1</p> <p class="p">2 Paragraph 2</p> <p class="p lastP">3 Paragraph 3</p> </body> </html>
Output Occuring: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>The Title</title> </head> <body> <p class="p firstP">1 Paragraph 1</p> <p class="p">2 Paragraph 2</p> <p class="p">3 Paragraph 3</p> </body> </html>
Thanks, Ross
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XQuery list, Joe Fawcett | Thread | Re: [xsl] function last() not match, Mukul Gandhi |
RE: [xsl] XHTML templating (best me, Michael Kay | Date | Re: [xsl] function last() not match, Mukul Gandhi |
Month |