XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> - XSL-fo and how to line feed th... (1)
-> + Houston we have a problem (2)
-> + XSL-FO PDF generation (2)
-> + StylusStudio - pick XSLT 1.0 b... (6)
-> - Stylus Studio 2010 debugging f... (1)
-> - Drop down menu List / Option M... (1)
-> - XML transformation using Java ... (1)
-> + i can't to find XSLT editor in... (2)
-> - Copy xml input as value of an ... (1)
-> - Remove Name space from the Tab... (1)
-> - CGI formatted URL with name/va... (1)
-> - Problem with counting (1)
-> + for-each loop is only returnin... (3)
-> - sort date but some dates may b... (1)
-> - Entity Conversion (1)
-> - How can I build an xml convert... (1)
-> + Little Help (2)
-> + how do I merge nodes to one sc... (2)
-> - beginner help xslt and xpath (1)
-> - Convert XML Feed to CSV/SQL/XL... (1)
-> - Working with text node. (1)
-> - No Topic (1)
-> - API for XSLT Converter for .NE... (1)
-> - Getting started (1)
-> + saxon sql extensions - mysql a... (2)
-> - How do I copy and create new e... (1)
-> + substring-before and sums (3)
-> + Parsing special characters in ... (2)
-> + Schema - Require attribute in ... (2)
-> - Edit existing XSL files when n... (1)
-> + How can I use one single XSLT ... (2)
-> - Default selection of value in ... (1)
-> - Problem with watermark in pdf ... (1)
-> + XSLT Parameter Values dialog n... (3)
-> + Value of File Name is not acce... (10)
-> - Need help with a complex table... (1)
-> - How to replace all nordic char... (1)
-> - XSLT java heap space error wit... (1)
-> - Table Overflow to next page (1)
-> - Using XSLT 2.0 to define custo... (1)
-> - "standalone" attribute and xs... (1)
-> + Standardizing IP addresses (2)
-> + Programmatically changing page... (6)
-> + Can Stylus generate XSLT if so... (5)
-> + Extraction based on NODE Name. (2)
-> + determine condition at run tim... (2)
-> - How to reduce top margin in ev... (1)
-> + need help on xsl looping (4)
-> - Convert Symbol to Element (1)
-> + Separator -only- between field... (3)
-> + DocBook (9)
-> + First Occurance of Alphabet (2)
-> + XSL:Key and Document (2)
-> + Excel Macro using XSLT (2)
-> + Add missing element and attrib... (2)
-> + XSL: Stop Count at First Match (2)
-> + XSD to EDI (4)
-> + How to access data from nested... (2)
-> + Simple division of XML file (2)
-> - XML to Flat File (1)
-> + Dispalying data whith xsl:for ... (3)
-> - distinct nodes - into 3 column... (1)
-> + Newbie at XML (2)
-> + XSL Not Working (3)
-> + to draw table using xsl (2)
-> + Base64 decoder (5)
-> + How to create a hidden sheet u... (3)
-> + XML Reports (2)
-> + Copying image files from one d... (2)
-> + XML conversion to RSS (2)
-> + Inserting Image (2)
-> + Xml to Pdf using Xsl (2)
-> + Using a parameter (or similar)... (2)
-> + How to avoid creating empty xm... (2)
-> + how to read txt files in xml (2)
-> + Limit records to 4 per page. P... (4)
-> + XSLT Mapping Based on JDK5 (2)
-> + XML Mappin (2)
-> + Format Datetime with xslt (3)
-> + Cell border missing (2)
-> + XSL: Key (not matches) (5)
-> + Loop through each char in stri... (2)
-> + What is the best way to sum va... (3)
-> + xslt sort help (2)
-> + getting the count (2)
-> + XSL dynamic variables (5)
-> + XSL:Key use (3)
-> + Help With Updating Attributes ... (8)
-> - Hi Everyone !! (1)
-> + Graph Traversal (Keep track of... (2)
-> + XSL IF with sum (2)
-> + Param not incrementing (2)
-> + Iterating through value tags (3)
-> + URGENT :::: Remove the name sp... (2)
-> + Pass new param values to ASP O... (2)
-> + Detect Browser Version in XSL (2)
-> + xslt result-document (2)
-> + Unique nodes based on two attr... (3)
-- Previous [181-200] [201-220] [221-240] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Mehran ZiadlooSubject: Applying more than one XSLT on the same XML
Author: Mehran Ziadloo
Date: 03 Nov 2005 09:56 AM
I had a question I hope I can find its answer here. I was wondering if it's possible to apply two (or more) XSLTs on the same XML file at the same time!!
Consider a situation that my XML file is created on-the-fly, and different parts of it requires different XSLT files to be displayed correctly as an XHTML. I might be able to create those XSLT files to apply and match the correct XML tags, and I know that I can have an XSLT file to be included in another XSLT file to combine their capabilities.
But my problem is that since my XML file could have different parts, the only time I know which XSLT files I need for renderring my XML correctly, is when I create the XML. So having an XSLT file to include all the necessary XSLTs, is not a solution to what I ask because there could be so many different combinations. I'm seeking for a way to specify more than one XSLT for my XML.

Any solution is appreciated, thanks
Mehran Ziadloo

Ivan PedruzziSubject: Applying more than one XSLT on the same XML
Author: Ivan Pedruzzi
Date: 03 Nov 2005 11:27 AM

XSLT is designed to handle those case pretty well, you just need to master the art of apply-templates.

Post a more concrete example and we will show you how.

Ivan Pedruzzi
Stylus Studio Team

(Deleted User) Subject: Applying more than one XSLT on the same XML
Author: (Deleted User)
Date: 03 Nov 2005 10:03 PM
Without more information of your exact problem, it is hard to give advice, but perhaps this will help.

You can chain two .xsl files together. The first one reads the .xml file and processes some of the nodes, and creates an output file. The second .xsl file reads the output of the first and processes more of the nodes. Each .xsl file processes whatever nodes it recognizes and copies the rest to the output unchanged. I have attached an example. There is an input.xml with 2 different types of elements, and there are 2 .xsl files, each of which processes 1 type of elements. You can chain as many together as you like.

The input .xml file

the first pass .xslt

the second pass .xslt

Mehran ZiadlooSubject: Applying more than one XSLT on the same XML
Author: Mehran Ziadloo
Date: 04 Nov 2005 04:06 AM
Ok, I'm sorry. You're right I had to explain my problem more specificly.
Here's an example of what I mean, it's so close to what Clyde understood, but I don't see how it suppose to work!!
Consider the files Clyde sent, but I would like to change the XML file like so:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="pass1.xsl"?>
<?xml-stylesheet type="text/xsl" href="pass2.xsl"?>
<elem1>data item 1-1</elem1>
<elem1>data item 1-2</elem1>
<elem2>data item 2-3</elem2>
<elem2>data item 2-4</elem2>

I know it's not working and I'm looking for an alternative way. As the Clyde said I want to apply a chain of XSLT files on my XML. So is it possible?

(Deleted User) Subject: Applying more than one XSLT on the same XML
Author: (Deleted User)
Date: 04 Nov 2005 05:54 AM
Can you please tell us a little more about why you can't chain the .xsl files one after another?

How much control do you have in your environment? Can you change the way the .xsl is started? Can you pass parameters to the .xsl? Can you change or rewrite the .xsl files? Can you change (slightly) the format of the .xml files?

Thanks much.

Mehran ZiadlooSubject: Applying more than one XSLT on the same XML
Author: Mehran Ziadloo
Date: 04 Nov 2005 08:32 AM
The fact is I'm trying to create a PHP Web Application Framework for my company. And right now I'm researching to understand how can I use XML to present the framework's front-end.
I want my code to create an XML output, based on the user input and other stuff and then use XSLT to render it. My problem is, since I would like to have as the most consistency as possible, I want to create stand-alone packages. Somehow that if I had to reuse a package, it requires the lowest possible effort.
As the conclusion, I need each package to have its own XSLT files. But these XSLT files are not about to create a complete HTML file becuase they are created to present a part of a page, not all of it, perhaps like a TABLE tag. And then with combining package's XML with other information, which they have XML structure too, I'll have an XML containing all the necessary information. But this XML requires different XSLT files to render correctly.
I know it's getting too long, but perhaps a practical example fixes everything:
Consider the user management package, there's a page to show the list of all users. Also there will be a page to show a single user info. I would like to design two XSLT files just to render the user list and user's info, I name them UserList.xsl and UserInfo.xsl, but their output's root tag will be a TABLE tag not HTML tag. I need an extra XSLT file to add the complemental tags, like HTML, lets name it PageDesign.xsl. Now think of the time you're about to see the list of users. There will be three files engaged, two of them we have already created, UserList.xsl and PageDesign.xsl. The third one, we have to create on-the-fly since its content depends on user input, and it's an XML file containing the actual information of user list.
But the time we are about to see the user info page, there will be a different set of pages engaged. UserInfo.xsl, PageDesign.xsl and on-the-fly created XML file of user info.
If you're reading this part of my letter, then you must be bored by now. That's all I'm asking, so can you please help me and give a clue how it's possible? One XML file and two XSLT files!!

Thanks alot for your patience,
Mehran Ziadloo

(Deleted User) Subject: Applying more than one XSLT on the same XML
Author: (Deleted User)
Date: 04 Nov 2005 09:58 PM
Can you do this? When you create the .xml file on the fly, also create a master .xsl file on the fly which has 1 <xsl:include.../> for each of the .xsl modules required. In your examle, you would be creating:

<xsl:include href="pageDesign.xsl"/>
<xsl:include href="userlist.xsl"/>

Then, you only need to run the .xml file through one .xsl file: the master .xsl file.


Mehran ZiadlooSubject: Applying more than one XSLT on the same XML
Author: Mehran Ziadloo
Date: 04 Nov 2005 10:18 PM
Well, that was something I thought too but practically it has some problems. The XML request and the XSLT request are not the same, so it's a little hard and strange to keep this connectivity. But if that's the only way you can think of, then thank you for your time. Becuase I'm sure if you can't do anything about it, then no one else can..

Thanks alot,
Mehran Ziadloo

Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.