cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skol...@dcsimtech.com
Subject Re: XML to PDF
Date Tue, 08 May 2001 01:33:01 GMT
Hi,

here in the List I got a kind of super stylesheet which copies the xml
Nodes in a new xml file with the stylesheet given as a parameter.

You save this file for example as master.xml and declare this stylesheet in
your xml file. Then you can link to your xml file for example by

your.domain.com/yourwebapp/yourxml.xml?pdf.xsl

and the stylesheet in the file pdf.xsl is assigned to your xml.

The only disadvantage is, that your xml is now processed two times per
click, but in most cases that should not be a problem.


-----------------------------beginning of
master.xsl------------------------

<?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">     <xsl:param name="style"/>
      <xsl:template match="/">
        <xsl:choose>
          <!-- when style is specified -->
          <xsl:when test="$style">
            <xsl:processing-instruction name="xml-stylesheet">
              href="<xsl:value-of select="$style"/>" type="text/xsl"
            </xsl:processing-instruction>
            <xsl:processing-instruction name="cocoon-process">
              type="xslt"
            </xsl:processing-instruction>
          </xsl:when>
          <!-- Otherwise use default.xsl -->
          <xsl:otherwise>
            <xsl:processing-instruction name="xml-stylesheet">
              href="default.xsl" type="text/xsl"
            </xsl:processing-instruction>
            <xsl:processing-instruction name="cocoon-process">
              type="xslt"
            </xsl:processing-instruction>
          </xsl:otherwise>
        </xsl:choose>         <xsl:apply-templates/>
      </xsl:template>       <!-- copy all elements -->
      <xsl:template match="@*|*|text">
        <xsl:copy-of select="."/>
      </xsl:template>
    </xsl:stylesheet>

-----------------------------end of master.xsl------------------------

cheers,

Sascha



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message