[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Consolidating stylesheet functionality

Subject: Re: Consolidating stylesheet functionality
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 24 Jan 2006 12:44:50 +0530
saxon8.jar
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.