0
votes

I tried to transform a XML document within a web browser to HTML via two XSL transformations.

Long story short: XML => XML => HTML

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml-stylesheet type="text/xsl" href="enrich.xsl" ?>
<?xml-stylesheet type="text/xsl" href="overview.xsl" ?>
<project></project>

The first XSL should add some elements to the XML, the second XSL should transform the result from the first step to HTML.

My target is to get HTML displayed at the end.

Both XSL are transformed separately.

It seems to me that Safari, Firefox and Chrome do not execute more than one processing instruction. Is this true, or am i missing something?

1
I don't think you can chain two stylesheets that way, the right way would be to have the first stylesheet generate an XML document with the second processing instruction. But as far as I remember only old versions of Opera (before they switched to using Chrome's rendering engine) supported chaining transformations that way. So currently all you can do is use script to run the transformations: developer.mozilla.org/en-US/docs/…. - Martin Honnen
Unfortunately you are right. Found no way to chain it this way. Thank you. - Kurt Battisti

1 Answers

0
votes

I never tried to execute two seperate transformations in a web browser, but you may try this kind of patterns to do "2 transforms in 1" (this only works with XSLT 2.0, cause of the variable structure) :

<xsl:template match="/">
     <!-- You use a variable to store the result of the first transformation.-->
     <xsl:variable name="result1">
           <!-- You use a mode called transform1 (or whatever) to distinct templates for
              transform1 from those of transform2-->
           <xsl:apply-templates select="*" mode="transform1"/>
     </xsl:variable>
     <!-- You execute the second transform on the result variable (you could use a
      mode to formally distinct the template from transform2, or you could use default
      mode for them) -->
     <xsl:apply-templates select="$result1"/>