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: <task> <person id="p001"> ... </person> </task> p001 refers to a person in another file structured like this: <people> <person id="p001" last="Heines" first="Jesse"> ... </person> </people> I can get at that person's last name by defining a variable to point to the file: <xsl:variable name="filePeople" select="string('people.xml')" /> and then using that variable inside a template using an xsl:value-of: <xsl:value-of select="document($filePeople)/people/person[@id=$strPersonID]/@last" /> (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. <xsl:apply-templates select="tasks/task"> <xsl:sort select="document($filePeople)/people/person[@id=$strPersonID]/@last" order="descending" /> </xsl:apply-templates> 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 each recursion. 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 issues. Thank you, Jesse Heines, heines@xxxxxxxxxx UMass Lowell Computer Science XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] String literal error, Américo Albuquerque | Thread | RE: [xsl] Using a reference in a so, Américo Albuquerque |
Re: [xsl] Adding another layer of g, Jeni Tennison | Date | [xsl] dictating node processing ord, Nathan Shaw |
Month |