From: G. Ken Holman (gkholman@CraneSoftwrights.com)
Date: Wed Feb 18 2004 - 14:10:19 PST
At 2004-02-18 13:58 -0500, Chris Cosentino wrote:
>I'm experiencing some odd behavior with sort.
>...
>My code to generate the index, unsorted, works fine:
>
><xsl:template name="index">
><fo:block>
>INDEX
><xsl:for-each select="//indexentry">
> <fo:block font="11pt Times" space-before.optimum="6pt">
>...
></fo:block>
></xsl:template>
>
>However, the following produces no output after "INDEX":
>
><xsl:template name="index">
><fo:block>
>INDEX
><xsl:for-each select="//indexentry">
> <xsl:sort>
> <fo:block font="11pt Times" space-before.optimum="6pt">
> <fo:wrapper text-transform="lowercase">
> <xsl:value-of select="."/>
> <fo:leader leader-pattern="dots"/>
> <fo:page-number-citation ref-id="{generate-id()}"/>
> </fo:wrapper>
> </fo:block>
> </xsl:sort>
> </xsl:for-each>
></fo:block>
></xsl:template>
Right ... you've structured it incorrectly
>No variation of the initial sort tag seems to work either (granted my
>select statements may be grasping at straws, but I tried EVERYTHING,
>several times):
>
><xsl:sort select = ".">
><xsl:sort select = "//indexentry">
><xsl:sort select = "indexentry">
><xsl:sort order-"descending">
>
>Any idea why absolutely no index is output when I put a sort statement in
>there, even the most basic sort with no options?
Yes ... you haven't learned that <xsl:sort/> is an *empty* element ... the
select attribute should be a relative specification, but it has *no*
content. It is a modifier of the <xsl:for-each> instruction.
Try:
<xsl:template name="index">
<fo:block>
INDEX
<xsl:for-each select="//indexentry">
<xsl:sort/>
<fo:block font="11pt Times" space-before.optimum="6pt">
<fo:wrapper text-transform="lowercase">
<xsl:value-of select="."/>
<fo:leader leader-pattern="dots"/>
<fo:page-number-citation ref-id="{generate-id()}"/>
</fo:wrapper>
</fo:block>
</xsl:for-each>
</fo:block>
</xsl:template>
>Obviously I need to read up on XPath a little better for my select
>statements, but I still don't understand why nothing is output with even
>just a basic sort.
All you've done is improperly formed the instruction. Your XSLT processor
should have flagged the illegal content to <xsl:sort/> ... it is an empty
instruction.
I hope this helps.
................... Ken
-- Public courses: upcoming world tour of hands-on XSL training events Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Washington, DC: 2004-03-15 San Francisco, CA: 2004-03-22 Hong Kong: 2004-05-17 Germany: 2004-05-24 England: 2004-06-07 World-wide on-site corporate, government & user group XML training! G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc ------------------- (*) To unsubscribe, send a message with words 'unsubscribe xep-support' in the body of the message to majordomo@renderx.com from the address you are subscribed from. (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
This archive was generated by hypermail 2.1.5 : Wed Feb 18 2004 - 14:19:31 PST