cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: One XML -> 2 XSLs
Date Wed, 22 Mar 2000 17:48:05 GMT
One way is to look at the problem from the other angle. Have an xml file for
each stylesheet. This xml file is basically a template that is set up to do
the XSL processing. The parameter you pass is the actual xml file you want
to process. You write a pointer to this file as a generated element in the
xml, and then in the stylesheet, include that document with the document()

In simplest terms, the xml:

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="myxsl.xsl" type="text/xsl"?>
<xsp:page language="java" xmlns:xsp="">

and the xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="">

<xsl:param name="file" select="/page/request-params/@file"/>

<xsl:template match = "page">
  <xsl:apply-templates select="request-params"/>

<xsl:template match="request-params">
  <xsl:variable name="xmlfile">path/to/xml/file/<xsl:value-of
  <xsl:apply-templates select="document($xmlfile)/document"/>

Slightly inelegant, but it works.

I believe that the SiteMap functionality coming in Cocoon2 will provide a
better way of achieving this.


Dr. Tim Dudgeon, Bioinformatics group leader
British Biotech Pharmaceuticals
Watlington Road, Oxford, OX4 5LY, UK
Tel: (44) 1865 748747
Fax: (44) 1865 781034

> -----Original Message-----
> From: Sven Kuenzler []
> Sent: 22 March 2000 3:04 PM
> To:
> Subject: One XML -> 2 XSLs
> Hello,
> is it possible to attach a XSL file "loosely" to a XML 
> document in order
> to create different views of that XML source? It would be nice if I
> could specify the XSL viva url, e.g.
>    Sven.....
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message