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

for-each or apply-templates on computed elements?

Subject: for-each or apply-templates on computed elements?
From: "Mark D. Anderson" <mda@xxxxxxxxxxxxxx>
Date: Wed, 24 Mar 1999 18:08:44 -0800
xsl constant
suppose i have several "section" elements in my source xml.
suppose further that there is a "role" attribute which has
to be author|caveats|usage|... .

now, in my xsl style sheet, i want to format those sections
in basically the same way, but i want to determine a fixed
order for those sections (say, author, usage, caveats, etc.)
which is independent of the order in the source xml.

i don't want that ordering to be placed in the source xml.

conceptually, i want to do something like:
<xsl:constant name="sorted_section_names">
  <s id="author"/><s id="usage"/><s id="caveats"/>
</xsl:constant>

<xsl:for-each select="{constant(sorted_section_names)}/s" var="foo">
  <xsl:apply-templates select="section[(@role=foo(@id)]"/>
</xsl:for-each>

or, as another approach:

<xsl:constant name="sorted_section_names">
  <s id="author" order="1"/><s id="usage" order="2"/><s id="caveats" order="3"/>
</xsl:constant>

<xsl:apply-templates select="section"><xsl:sort select="{constant(sorted_section_names)/s[@role=@id]@order"/>

both of the above don't work, of course.

-mda



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


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.