[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Introducing a comma.

Subject: Re: Re: Introducing a comma.
From: Paul DuBois <paul@xxxxxxxxxxxx>
Date: Tue, 18 Nov 2003 12:49:05 -0600
commas after without last xsl
On Tue, Nov 18, 2003 at 01:08:39PM -0500, cknell@xxxxxxxxxx wrote:
> Sorry if another version of this appears without the stylesheet. I expected this stylesheet to work just the way the example shown in the spec does, but the comma appears after all instances of <in>. Can anyone see what I'm missing?
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:output method="xml" indent="yes" encoding="UTF-8" />
> 
>   <xsl:template match="/signature">
>     <signature>
>       <xsl:apply-templates />
>     </signature>
>   </xsl:template>
> 
>   <xsl:template match="*">
>     <xsl:choose>
>       <xsl:when test="name() = 'in'">
>         <xsl:copy-of select="." />
>         <xsl:if test="not(position() = last())">
>           <xsl:text>,</xsl:text>
>         </xsl:if>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:copy-of select="." />
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>
> 
> </xsl:stylesheet>
> -- 
> Charles Knell
> cknell@xxxxxxxxxx - email

Your input document is:

<signature>signature <identifier>DNSQuery</identifier>
   <in>in<long>long</long><identifier>a</identifier></in>
   <in>in<string>string</string><identifier>b</identifier></in>
   <in>in<float>float</float><identifier>c</identifier></in>
</signature>

I suppose you are expecting position() to be 1, 2, or 3, and last() to
be 3.  But they're not.  You have text nodes (both empty and non-empty)
within your <signature> element.

For your document,  position() is 4, 6, and 8, and last() is 9.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Re: Introducing a comma., (continued)
    • M. David Peterson - Tue, 18 Nov 2003 12:44:34 -0500 (EST)
    • kakridge - Tue, 18 Nov 2003 12:50:27 -0500 (EST)
    • cknell - Tue, 18 Nov 2003 13:07:04 -0500 (EST)
    • cknell - Tue, 18 Nov 2003 13:08:47 -0500 (EST)
      • Paul DuBois - Tue, 18 Nov 2003 13:49:17 -0500 (EST) <=
      • David Carlisle - Tue, 18 Nov 2003 16:52:21 -0500 (EST)
    • cknell - Tue, 18 Nov 2003 13:21:20 -0500 (EST)
    • cknell - Tue, 18 Nov 2003 14:46:18 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.