You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robby Pelssers <Ro...@nxp.com> on 2012/10/12 16:13:06 UTC

transformer does not always need a generator

Hi guys,

Just wanted to point out a small mistake in the pipeline concept.  It seems like a pipeline should not always (have to admit most of the times it does) start with  a generator. I accidentally ran into this .

An XSLT can load data by itself using document() and collection function.    I know that cocoon style of working is to usually use a generator instead of calling the document function inside an XSLT. But not so for a collection though.

Let me show you.  To get this working in Cocoon I had to use a dummy generator just to get this working.  No big deal... just mentioning it.

      <map:match pattern="mergefeatures">
        <map:generate src="page/index.html"/> <!-- dummy generator -->
        <map:transform src="xslt/merge/mergeFeaturesAndBenefits.xslt" type="saxon"/>
        <map:serialize type="xml"/>
      </map:match>


<?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" version="1.0" encoding="UTF-8" indent="yes"/>

  <xsl:variable name="fb_topics" select="collection('file:///C:/tmp/value-proposition/67/features-benefits/?select=*.dita')"/>

  <xsl:template match="/">
    <result><xsl:value-of select="count($fb_topics)"/></result>
  </xsl:template>
</xsl:stylesheet>

Robby