|
Subject: for-each or apply-templates on computed elements? From: "Mark D. Anderson" <mda@xxxxxxxxxxxxxx> Date: Wed, 24 Mar 1999 18:08:44 -0800 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Event Handling, Guy_Murphy | Thread | first-of-any operates before or aft, Mark D. Anderson |
| Re: template matching.. display the, Marcus Carr | Date | Re: template matching.. display the, Adam M Donahue |
| Month |