xsl-list
[Top] [All Lists]

RE: [xsl] multiple transformations (pipelining) in one stylesheet

2007-10-19 08:24:56


The general model is

<xsl:variable name="phase-1-output">
  <xsl:apply-templates select="/" mode="phase-1"/>
</xsl:variable>

<xsl:variable name="phase-2-output">
  <xsl:apply-templates select="$phase-1-output" mode="phase-2"/>
</xsl:variable>

<xsl:template match="/">
  <xsl:apply-templates select="$phase-2-output" mode="phase-3"/>
</xsl:template>

Use modes to make it clear which templates apply to which phase of
processing.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Oliver Lietz [mailto:list(_at_)oliverlietz(_dot_)de] 
Sent: 19 October 2007 16:08
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] multiple transformations (pipelining) in one stylesheet

Hello all,

this is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<file>
  <content>
    <title>Lorem ipsum</title>
    <para><acronym text="Lorem ipsum"/> dolor sit amet, ...</para>
  </content>
</file>

and here my xsl file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="xml" encoding="UTF-8" 
omit-xml-declaration="yes"/>

  <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
  </xsl:template>

  <xsl:template match="acronym">
    <xsl:value-of select="@text"/>
  </xsl:template>

  <xsl:template match="/">
    <p>
      <xsl:value-of select="/file/content/para"/>
    </p>
  </xsl:template>

</xsl:stylesheet>

The second and third template alone with the first work as I 
expect but the result should look like this:

<p>Lorem ipsum dolor sit amet, ...</p>

So what's the best way to use the result of the first 
transformation (replace
acronyms) as source for the second (make html)?
I searched the web and this list and tried different 
approaches but didn't succeed so far. Any hints? (using Saxon-B 8.9/j)

tia,
O.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--