Subject: Re: [xsl] Consolidating stylesheet functionality From: omprakash.v@xxxxxxxxxxxxx Date: Tue, 24 Jan 2006 12:44:50 +0530 |
Hi, This functionality is built into XSLT 2.0. See the following for an example of using temporary trees. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="phase1.xsl"/> <xsl:import href="phase2.xsl"/> <xsl:variable name="intermediate"> <xsl:apply-templates select="/" mode="phase1"/> </xsl:variable> <xsl:template match="/"> <xsl:apply-templates select="$intermediate" mode="phase2"/> </xsl:template> </xsl:stylesheet> Further, read below about the use of modes. The algorithm for matching nodes against template rules is exactly the same regardless which tree the nodes come from; if nodes from different trees cannot be distinguished by means of patterns, it is a good idea to use modes to ensure that each tree is processed using the appropriate set of template rules Hope this helps. cheers, prakash Tim Lebo <timleboxslt@gma To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx il.com> cc: (bcc: omprakash.v/Polaris) Subject: [xsl] Consolidating stylesheet functionality 01/24/2006 07:25 AM Please respond to xsl-list I am using Kay's Modified Identity Transform Pattern to add an attribute (@number) to certain elements (object | link). The attribute values are unique values. The input and output are show below. Is it possible to "capture" the result of this ID-assignment processing and continue to manipulate the temporary tree after the new attributes have been added, thus allowing all processing to be captured in a single stylesheet? This seems to touch on the functionality of xsl:function and/or xsl:import. Any references to sections of Kay's XSLT 2.0 ed 3 would be appreciated (I'm only on page 70 of a complete read-through). Currently, I have two xsl sheets: java -jar saxon8.jar input.xml modifiedIdentityTransform.xsl > input-numbered.xml java -jar saxon8.jar input-numbered.xml myadditionalProcessing.xsl > finally-done.xml I would like a single xsl that consolidates the functionality of both xsls. myAdditionalProcessing.xsl could be anything that relies on the @number attribute on the object and link elements. Regards, Tim Lebo the input and output: <?xml version="1.0" encoding="UTF-8"?> <root> <object id="a"> <attribute name="color" value="red"/> </object> <object id="b"> <attribute name="size" value="big"/> </object> <object id="c"> <attribute name="size" value="small"/> <attribute name="color" value="purple"/> </object> <link fromobject="c" toobject="b"/> </root> <?xml version="1.0" encoding="UTF-8"?> <root> <object id="a" number="1"> <attribute name="color" value="red"/> </object> <object id="b" number="2"> <attribute name="size" value="big"/> </object> <object id="c" number="3"> <attribute name="size" value="small"/> <attribute name="color" value="purple"/> </object> <link fromobject="c" toobject="b" number="4"/> </root>[ This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit Us at http://www.polaris.co.in
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Consolidating stylesheet func, Tim Lebo | Thread | [xsl] Loading XML with XSL for sort, Bjorn Van Blanckenbe |
[xsl] Consolidating stylesheet func, Tim Lebo | Date | Re: [xsl] simple xslt question, ret, Ragulf Pickaxe |
Month |