|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] for-each or apply-templates on computed elements?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








