[XSL-LIST Mailing List Archive Home]
[xsl] Using a reference in a sort
Subject: [xsl] Using a reference in a sort|
From: "Jesse M. Heines" <heines@xxxxxxxxxx>
Date: Tue, 29 Jul 2003 06:45:01 -0400
I am trying to sort data based on an externally referred to value. My
main XML file looks like this:
p001 refers to a person in another file structured like this:
<person id="p001" last="Heines" first="Jesse">
I can get at that person's last name by defining a variable to point to
<xsl:variable name="filePeople" select="string('people.xml')" />
and then using that variable inside a template using an xsl:value-of:
(where $strPersonID is the ID extracted from the main XML file).
What I can't seem to be able to do is sort using this field.
The problem is that one must use variables due to the context node
switching in this long XPath statement, but XSL won't let me use
xsl:variable inside an xsl:apply-templates statement. The variable must
be defined inside the xsl:apply-templates tag so that it changes with
I tried using xsl:for-each, which does allow xsl:variable inside it, but
only *after* xsl:sort, so that doesn't work either.
I would appreciate any suggestions anyone can make to address these
Jesse Heines, heines@xxxxxxxxxx
UMass Lowell Computer Science
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list