Subject: Re: [xsl] sorting and merging From: Francis Norton <francis@xxxxxxxxxxx> Date: Tue, 03 Apr 2001 19:31:30 +0100 |
Riboni Ugo wrote: > > hi everybody, > i'm new ot this list but maybe someone can can give me some help > to solve this problem i have. > Welcome. This is a nice problem to demonstrate the advantages of "push" style xslt programming, where the flow of control is determined by the structure of the data being transformed, not directly by the transform. It's a bit like event driven programming, and makes it very easy to do things like saying "pass everything straight through unless it's an 'x'". I copied your fragment file directly, and just tidied up your main file a bit. The transform is nice and simple. Hope this helps - Francis. C:\xml>type t.xml <?xml version="1.0" encoding="UTF-8"?> <ex> <qs> <q type="S"> <as> <a>txt</a> </as> </q> </qs> </ex> C:\xml>type t.xslt <?xml version="1.0"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <!-- the identity transform - passes anything straight through ... --> <xsl:template match="@*|node()[not(self::as)]" > <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <!-- --> <!-- ... except for "as" elements - a specific match has a higher priority --> <xsl:template match="as"> <xsl:for-each select="document('new-vals.xml')/temproot/a"> <xsl:sort select="@new" data-type="number"/> <xsl:copy-of select="."/> </xsl:for-each> </xsl:template> <!-- --> </xsl:transform> C:\xml>saxon t.xml t.xslt <?xml version="1.0" encoding="utf-8"?> <ex> <qs> <q type="S"> <a new="1">txt</a> <a new="2">txt</a> <a new="3">txt</a> </q> </qs> </ex> C:\xml> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] sorting and merging, Riboni Ugo | Thread | [xsl] Absolute path for a DTD and a, Fr\id\iric SCHWEBEL |
RE: [xsl] Latest XSLTMark benchmark, Kevin Jones | Date | [xsl] Dual XSLT processes for one X, Jay |
Month |