chained stylesheets

Are you missing a feature? Request its implementation here.
xan

chained stylesheets

Post by xan »

Could use the ability to chain stylesheet transformations, or something more general like XML Pipeline:

http://www.w3.org/TR/2002/NOTE-xml-pipeline-20020228/

My situation is that the output of one transformation is the input to another one.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Xan,

<oXygen/> has support for applying multiple XSLT stylesheets in one transformation. See the "Cascade styelsheets" option in the transformation scenario dialog on the XSLT tab.
Each stylesheet will get as input the result of previous XSLT transformations.

Best Regards,
George
xgregg
Posts: 3
Joined: Sat Nov 13, 2004 5:26 pm

Post by xgregg »

Thanks for the quick reply, George. I tried that but couldn't get it to work and assumed it was for CSS stylesheets instead of XSLT stylesheets. The error I get is "E Failure reading null null ". (I always like apps that let me Copy error messages!)

I was looking for something like "Chain Scenario" so the next transformation could have its own parameters and output info, too. Fortunately, only my first transformation requires parameters, so I'm hopeful I can get this to work. Any ideas?

xan
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Post by tavy »

Hi Xan,

I tested the cascade stylesheet transformation and I didn't see any problems.
See bellow the files that i used in transformation :

The XML file :

Code: Select all

 
<?xml version="1.0" encoding="UTF-8"?>
<root>
<elem>Cascade</elem>
</root>
The first XSL file :

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<Step1>
<xsl:apply-templates mode="copy" select="."/>
</Step1>
</xsl:template>
<xsl:template match="*" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
The second XSL file :

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="p" select="''"/>
<xsl:output method="xml"/>
<xsl:template match="/">
<Step2>
<xsl:apply-templates mode="copy" select="."/>
<param>The val of param p: <xsl:value-of select="$p"/>
</param>
</Step2>
</xsl:template>
<xsl:template match="*" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I also added the parameter "p" with value "paramValue" in the parameters list.

The result of the transformation must be :

Code: Select all


<?xml version="1.0" encoding="utf-8"?>
<Step2>
<Step1>
<root>
<elem>Cascade</elem>
</root>
</Step1>
<param>The val of param p: paramValue</param>
</Step2>
If you still have problems please send us some samples to support@oxygenxml.com.

Best Regards,
Octavian
xgregg
Posts: 3
Joined: Sat Nov 13, 2004 5:26 pm

Post by xgregg »

Thanks Octavian, Your example worked fine*. I tried experimenting with my setup, and after switching to Xalan the error message was much more informative:

F java.io.FileNotFoundException: /Users/xan/Code/oxygen Folder/local.dtd (No such file or directory) 1:0

My intermediate file has a dtd ref with a relative path, and it's resolving to the oxygen home directory instead of my work directory. I guess that intermediate file doesn't really have a URI, but things would work if you gave it the systemID of the original source file. I tried copying all the needed files into the home directory and the cascaded transform worked fine.

Thanks for your help.

xan

*Well, there was one problem with using your sample you should be aware of. After copying it into oxygen, I was getting strange XSLT errors; eventually I figured that the copy/paste had grabbed some hidden characters (0xCA), which may be nbsp characters.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Xan,

Thanks, we were able to reproduce the problem with 5.0. It was already fixed in the current development stream so the fix will go in the next release.

Best Regards,
George
xgregg
Posts: 3
Joined: Sat Nov 13, 2004 5:26 pm

Post by xgregg »

Thanks. This is a great feature.
Post Reply