Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I apply a XSL to the result of another XSL?

 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I�d like to apply a XSL to a XML generated from another XSL.
I cannot use VB or a different language to do this. I have no choice to use XSL.
XML => (XSL => XML => XSL)* => XML
* Done in one XSL
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks sort of like the chaining of XSLT transformer steps that takes place in Cocoon, but I don't think you need to get that complicated.
Mainly you need to realize that there are lots of ways to make a Source that a Transformer can read. Do you already have a particular XML toolkit that you have to use or can you use any Java? If you don't have anything already, download the latest XML pack from java.sun.com.
Bill
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it�s like a sort of chaining of XSLT.
Unfortunately I cannot use Java.
I already have a client code which loads each XSL file and applys them to the XML (chaining). But I have to do the same process only using XSLT now.
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
parser input.xml ini.xsl output.xml
The ini.xsl file must call 4 xslt files in this order
1. filter.xsl (uses input.xml as a input xml file)
2. validator1.xsl (uses the xml file generated in step 1 as a input
xml file)
3. validator2.xsl (uses the xml file generated in step 1 as a input
xml file)
4. validator3.xsl (uses the xml file generated in step 1 as a input
xml file)
5. format.xsl (uses the xml file generated in step 2+3+4)
How to apply/call xsl file inside a xsl file?
How can I do that?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd just write a shell script to do these repeated invocations.
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I look at your shell script?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't quite understand the problem.
You are applying validator1.xsl, validator2.xsl, and validator3.xsl all to the same input file? You are not applying each step to the output of the previous step?
What do you mean by "uses the xml file generated in step 2+3+4" ?
 
Brian Grey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to apply validator1.xsl, validator2.xsl, and validator3.xsl to the result of the filter.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:user="userhtml">

<xsl:import href="filter.xsl"/>

<xsl:import href="validator1.xsl"/> //VALIDATE_Request1
<xsl:import href="validator2.xsl"/> //VALIDATE_Request2
<xsl:import href="validator3.xsl"/> //VALIDATE_Request3

<xsl utput omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="VALIDATE_Request1">
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

I apply to the temporary result a template called VALIDATE_Request1. This works fine. But now, how can I apply the second template called VALIDATE_Request2 to the same temporary result?
You are not applying each step to the output of the previous step? No
What do you mean by "uses the xml file generated in step 2+3+4" ?
After applying each filter, I have to transform the result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic