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

want to sort and resolve <xref> values in one pass (X

Subject: want to sort and resolve <xref> values in one pass (XSL-FO)
From: "Flanders, Charles E (US SSA) charles.flanders@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Jul 2014 21:49:18 -0000
 want to sort and resolve <xref> values in one pass  (X
I am currently using a two-step process to sort a list of cross references in
an FO file. I run the pub through my XSL-FO style sheets, then run my
resultant FO file through a second XSLT (FO to FO) to sort the results of
resolved cross references.

I have a list of cross references the looks like this:

      <ref>
       <ref-setup-item>
        <xref wpid="t2034592355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2001792355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2002292355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2004392355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2087492355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2087692355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2078292355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2078392355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2078692355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2110492355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2078892355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2085792355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2002492355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2002992355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003292355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2089592355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2089692355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2089792355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003592355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003692355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003492355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003792355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2100192355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2003992355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2004092355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2004192355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2100092355314"/>
       </ref-setup-item>
       <ref-setup-item>
        <xref wpid="m2033692355314"/>
       </ref-setup-item>
      </ref>

The FO output is this:



                  <fo:block widows="2" orphans="2" space-before.minimum="6pt"
space-before.optimum="7pt"
                            space-before.maximum="8pt"
                            space-after.minimum="0pt"
                            space-after.optimum="0pt"
                            space-after.maximum="1pt"
                            span="none" role="REFERENCES">
                     <fo:block font-weight="bold"
keep-with-next.within-column="always">References</fo:block>
                     <fo:block font-weight="normal"
keep-with-previous.within-column="always" span="none"
                               start-indent="12pt"
                               text-align="left">
                        <fo:basic-link>Vol. 4, WP 0313</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left"
                               keep-with-previous.within-column="always">
                        <fo:basic-link>Vol. 8, WP 0598</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 9, WP 0772</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0681</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0613</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0635</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0645</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0646</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 9, WP 0773</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0647</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0654</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0632</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0639</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0655</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0662</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0663</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0664</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0665</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0667</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0668</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0634</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0666</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0642</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0674</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0675</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 8, WP 0676</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 10, WP 0926</fo:basic-link>
                     </fo:block>
                     <fo:block font-weight="normal" span="none"
start-indent="12pt" text-align="left">
                        <fo:basic-link>Vol. 10, WP 0988</fo:basic-link>
                     </fo:block>
                  </fo:block>

Currently I run a second XSLT (below> to sort the FO output.

    <xsl:template match="fo:block[@role='REFERENCES']">
        <fo:block widows="2" orphans="2" space-before.minimum="6pt"
space-before.optimum="7pt" space-before.maximum="8pt"
space-after.minimum="0pt" space-after.optimum="0pt" space-after.maximum="1pt"
span="none" role="REFERENCES">
            <xsl:copy-of select="child::fo:block[1]"/>
                <xsl:apply-templates select="child::fo:block[position() &gt;
1]">
                    <xsl:sort
select="substring-after(fo:basic-link/text(),'WP')"/>
                </xsl:apply-templates>
        </fo:block>
    </xsl:template>

Instead of running the second XSLT, I want to perform the sort with the
initial style sheet run. I know I can capture the unsorted output into a
variable, but where I'm having trouble is sorting the contents (value) of the
variable and then writing out the sorted output. What I have so far (and this
is just a snippet of a much larger XSL-FO style sheet of nearly 80 modules).

	<xsl:template match="ref">
		<fo:block space-before.maximum="8pt" space-before.minimum="6pt"
space-before.optimum="7pt" span="none" xsl:use-attribute-sets="wpinfosub">
			<fo:block font-weight="bold" keep-with-next.within-column="always">
				<xsl:text>References</xsl:text>
			</fo:block>
			<xsl:variable name="REFS">
				<xsl:apply-templates select="child::ref-setup-item"/>
			</xsl:variable>
			<xsl:apply-templates select="$REFS">
				<xsl:sort select="substring-after(child::basic-link/text(),'WP')"/>
			</xsl:apply-templates>
		</fo:block>
	</xsl:template>


The above does not work. I do know that the value of $REFS is correct in that
I've used <xsl-copy-of select="$REFS" to verify the value or contents of
$REFS. How I do sort the value of $REFS and put it into the output? Using the
above is outputting the <fo:root> and  <fo:layout-master-set>, then "value-of"
(just text) $REFs with no FO markup. What am I missing?


C Flanders

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.