xsl-list
[Top] [All Lists]

Using saxon:assign and testing content of variable

2005-09-20 10:55:30
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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--