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

Re: Limitations of Includes in XSL

Subject: Re: Limitations of Includes in XSL
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Tue, 25 Apr 2000 12:58:02 -0700
xsl html limitations
Ken,

If I'm understanding what you want:

  -> a reusable "chunk" of tags and <xsl:***> elements
   
  -> that is responsible for handling the formatting for
     the "ChargeListRSQ" block of your source document 

  -> In a way that allows the "chunk" of tags to
     use xpath expressions that are relative to the 
     "ChargeListRSQ"

  -> Without mentioning a particular XML file that <ChargeListRSQ>
     "lives in"...

Then an <xsl:template> can do all these for you.

Let's say your data looks like this:

<TR300>
  <ChargeListRSQ>
     <Charge id="1">ABC</Charge>
     <Charge id="2">DEF</Charge>
  </ChargeListRSQ>
</TR300>

Then you can create a "tab.xsl" stylesheet with a template
whose match pattern is match="ChargeListRSQ", and it will 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

   <!-- This template handles ChargeListRSQ "block" -->
   <xsl:template match='ChargeListRSQ'>
     <table border="1">
        <xsl:for-each select="Charge">
          <tr>
             <td><xsl:value-of select="@id"/></td>
             <td><xsl:value-of select="."/></td>
          </tr>
        </xsl:for-each>
     </table>
   </xsl:template>

</xsl:stylesheet>

and then include "tab.xsl" into another main stylesheet like "main.xsl"...

  <xsl:output method="html" indent="yes"/>

  <xsl:include href="tab.xsl"/>

  <xsl:template match="/">
    <html>
      <body>
         <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>

And by the magic of the "Apply Templates" processing, when it comes
time for handle the formatting for the <ChargeListRSQ> in the source,
your template will "fire" and your reusable chunk of tags will kick in.

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
Business Components for Java & XSQL Servlet Development Teams
Oracle Rep to the W3C XSL Working Group


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.