Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to manage multiple XSL files that are nearly identical?

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 8/6/2008 2:11:00 PM

Siegfried Heintze wrote:

> So here is the XSL question:
> Is there a way I can pass a parameter (or something) so it will generate a 
> page tag, windows tag, or canvas tag so I don't have to maintain three 
> otherwise identical XSL files?

You can write stylesheet modules and compose them using xsl:include or 
xsl:import, see http://www.w3.org/TR/xslt#section-Combining-Stylesheets
That might already suffice to avoid having three huge, nearly identical 
stylesheets, instead you would simply put the identical part into a huge 
module and then write three other small ones that include or import the 
module.

If you want to work with a parameter then that is also possible, you can 
define a global parameter (e.g. root-name) in your stylesheet e.g.

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

     <xsl:param name="root-name" select="'window'"/>

     <xsl:template match="/">
       <xsl:element name="{$root-name}">
         ...
       </xsl:element>
     </xsl:template>

     ...
   </xsl:stylesheet>

and then you would use a (processor specific) way to set the parameter 
root-name to e.g. 'window' or 'page' before you run the transformation.




-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent