cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Weinmann <aweinm...@bct-technology.com>
Subject Re: generating xsl processing instructions
Date Tue, 08 Aug 2000 12:27:05 GMT
Lisa van Gelder wrote:
> 
> 
> I'm converting html into xml and xsl. I have one template that strips off
> all formatting info (table tags, paragraph tags, divs, spans etc) and turns
> the rest into xml, and another template that keeps all the formatting info
> and puts placeholders so that the xml elements can be slotted into place
> when the stylesheet is called. What I want is a stylesheet that generates
> another stylesheet including the xsl instructions. I want a stylesheet that
> [...]

Below I give you an example how to write a stylesheet that generates
another stylesheet. The namespaces have to be remapped. 
I had problems with that using Xalan, but it worked with SAXON:


 <?xml version="1.0"?>

<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:exsl="http://www.w3.org/1999/XSL/TransformAlias" >


  <xsl:namespace-alias stylesheet-prefix="exsl" result-prefix="xsl"/>
  <xsl:output method="xml" indent="yes" />


  <xsl:template match="/" >
    <exsl:stylesheet    version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

      <exsl:template match="what-you-want">
         <!-- what you want -->
      </exsl:template>

      <exsl:template match="something-else">
	<a>
	  <exsl:attribute name="href"><exsl:value-of
select="@href"/></exsl:attribute>
	  <exsl:value-of select="text()"/> 
	</a>
      </exsl:template>
    </exsl:stylesheet>
  </xsl:template>
</xsl:stylesheet>

Mime
View raw message