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

Import stylesheets in Xalan again

Subject: Import stylesheets in Xalan again
From: "Andrey Guskov" <andrey.guskov@xxxxxxx>
Date: Sun, 23 Feb 2003 10:01:53 +0300
xalan import
Thank you for your answers but they don't solve the problem.
I want to give some explanations about my situation.
We have web application which pages have xml mark-up and the design created by xsl.
There are many xsl templates which are used by all pages in our project. So we want to put
them into the separate file and import this stylesheet in all other files.
In order to decrease the transformation time we want to parse this stylesheet on application
loading and store it in the memory so we are able to automatically import it during the 
concrete transformation. So standard <xsl:import> and <xsl:include> instruction is not applicable.

The following code work perfectly in Xalan-1:

//On application loading:
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
Vector imports = new Vector();
StylesheetRoot sheet1 = processor.processStylesheet(xslInputSource1);
imports.add(sheet1);
//During the concrete transformation:
StylesheetRoot sheet2 = processor.processStylesheet(xslInputSource2);
sheet2.setImports(imports); //special method for importing parsed stylesheets
//In this case sheet2 contains templates from both stylesheets sheet1 and sheet2

But the following code similar to the previous one doesn't work in Xalan-2:

//On application loading:
TransformerFactory factory = TransformerFactory.newInstance();
StylesheetRoot sheet1 = (StylesheetRoot)factory.newTemplates(xslInputSource1);
//During the concrete transformation:
StylesheetRoot sheet2 = (StylesheetRoot)factory.newTemplates(xslInputSource2);
sheet2.setImport(sheet1);
//In this case sheet2 still contains templates only from stylesheets sheet2;
//templates from sheet1 are not found during the xml transformation

I'll be very thankful if you help me to solve this problem.
Andrey

 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.