This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Wrapper for XSL for offline development



Unfortunately, I believe, Xalan does not support the node-set extension
function.
I had hoped to be able to chain the stylesheets.
So I took Jeni's suggestion to write the combined XML source and processed
PI's
to a temp file and apply the production XSL to it.  A small batch file
automates the
process.

So for anybody else who needs this type of functionality, here is the
"wrapper" xsl file (Just as Jeni wrote it with one modification):

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:apply-templates />
  </xsl:copy>
</xsl:template>

<xsl:template match="processing-instruction('fusa-process')">
  <!-- identify the file from the content of the PI -->
  <xsl:variable name="file"
                select="substring-before(substring-after(., ':'), ':')"
                />
  <!-- copy the content of the file (the document element)
       into the output -->
  <xsl:copy-of select="document(concat($file, '.xml'))/*" />
</xsl:template>

</xsl:stylesheet>


Here is the MSDOS batch file using Xalan:

@echo off
REM wrapXSL.bat
REM Batch file to provide a wrapper on production XSL that supplies static
REM data to the PIs in the source XML.
REM Usage:  wrapXSL.bat  source.xml  transform.xsl  result.html
REM check arguments: %1=source XML, %2=script XSL, %3=result file

java org.apache.xalan.xslt.Process -in %1 -xsl wrap.xsl -out out.xml
java org.apache.xalan.xslt.Process -in out.xml -xsl %2 -out %3


Many thanks to Jeni for her suggestions!


Alan Harbaugh
First USA Bank, N.A.           Information Services

201 N. Walnut Street           Tel: (302)282-2098                         
Wilmington, DE 19801           Fax:(302) 282-2198                         
DE1-1525                       AlanHarbaugh@FirstUSA.com     


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]