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

Re: strangeness with <xsl:variable>

Subject: Re: strangeness with <xsl:variable>
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 23 Dec 2000 20:31:46 +0000
xsl variable number formats
Hi Mike,

Just a couple of comments:

> 1.) use <xsl:text>sect-</xsl:text><xsl:number/>, which I haven't
> done throughout the whole transform. It's a wonder that this didn't
> bit me before.

You may find it helpful to use Allouche's method for getting rid of
whitespace here, i.e. use an empty xsl:text element to indicate the
end of ignorable whitespace:

  <xsl:text />sect-<xsl:number />

It's a little shorter, and a little more readable.  You don't have to
use xsl:text at all if there's no whitespace, of course:

  format="1" level="single" count="section"/></xsl:when>

will produce exactly the same as:

  <xsl:when test="parent::introduction">sect-intro<xsl:number
  format="1" level="single" count="section"/></xsl:when>

The alternatives:

  <xsl:when test="parent::introduction">
    <xsl:text />sect-intro<xsl:number format="1" level="single"


  <xsl:when test="parent::introduction">
    <xsl:number format="1" level="single" count="section" />

just give nicer formatting within the stylesheet (especially if you
have a fixed line length).

> <xsl:number format="I.1.1" level="multiple" count="//part | chapter
> | section"/>

The 'count' attribute gives a match expression against which the
ancestors and their preceding siblings are matched to create the
numbering scheme.  In your 'count' attribute, the first term is
'//part', which matches any 'part' element that is a descendant of the
root node.  This will match any 'part' elements that it comes across,
as will, simply 'part'.  There is never any point in having '//' at the
beginning of a match pattern: the only constraint it adds is that the
node is a descendant of the root node, which is true for all nodes -
it's therefore no constraint at all, and completely superfluous.

I hope that helps,


Jeni Tennison

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

Current Thread


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.
First Name
Last Name
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.