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

Using saxon:assign and testing content of variable

Subject: Using saxon:assign and testing content of variable
From: Dan Vint <dvint@xxxxxxxxx>
Date: Tue, 20 Sep 2005 10:55:30 -0700
saxon assign
I'm still working on my Index. Now I'm trying to gather the index terms up and group them and then generate the page numbers.

I'm using Saxon 6.5 and the group and item extensions to make this process reasonable. I've got the headings seeming to work properly up to 3 levels with see and see also support. Now I'm trying to gather up the page numbers with their markup and output them as a single statement once all the page numbers are gathered.

The process I wrote myself into has me collecting the page numbers in a variable that I can assign to with another saxon function. This was the template I had written:

<xsl:template name="page-sequence">
     <xsl:param name="NumberPage" select="false()" />

<xsl:if test="$NumberPage">
<xsl:choose>
<xsl:when test="$pageNumber=''">
<saxon:assign name="pageNumber">
<fo:leader leader-pattern="dots" leader-length="1in" />
<fo:basic-link internal-destination="{generate-id()}">
<fo:page-number-citation ref-id="{generate-id()}" />
</fo:basic-link>
</saxon:assign>
</xsl:when>
<xsl:otherwise>
<!-- similar stuff here for continuation -->
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>


As you see I'm assigning the <fo> markup to the variable and in the otherwise, I was adding additional page numbers with a comma separator.

What I'm at a loss for is the proper test in the <choice> to see if there is content in $pageNumber.

First what is the proper way to reset the variable to be empty and hopefully no nodes in the node-set? Does a simple <saxon:assign name="pageNumber"/> do it?

What is the best test to detect content in $pageNumber? I tried count() but it always returns 1, and the test for the empty string is not working either.

thanks
..dan

---------------------------------------------------------------------------
Danny Vint

Specializing in Panoramic Images of California and the West
http://www.dvint.com

voice: 510-522-4703

Current Thread

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.