cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <andrewm...@gmail.com>
Subject XSL: match all elements except one section... node()[not(self::login_fields)]
Date Wed, 19 Jul 2006 14:52:16 GMT
Hi,
I have an xsl template for which I wish to match (process) all elements in
the document except one:

node()[not(self::login_fields)]

I have placed this at the bottom of my xsl document. What am I wishing to
achieve you ask? Well I have 2 stylesheets transformations in a sitemap
pipe. The first xsl document contains the section I want ignored, and the
second, forms-samples-styling.xsl, is the document I want to handle the
transformation of the section ignored in the first xsl document. Clear?!? My
sitemap looks like:

                <map:generate type="jx" src="jx/{2}.jx"/>
                <map:transform type="browser-update"/>
                <map:transform type="xslt-saxon" src="style/{2}.xsl"/> //
This is the xsl doc containing the section
                <map:transform
type="cinclude"/>                                // I want transformed by
forms-samples-styling
                <map:transform type="i18n" />
                <map:transform src="template-style/forms-samples-styling.xsl
"/>


So my xsl document, style/{2}.xsl looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:cinclude="http://apache.org/cocoon/include/1.0">
        <xsl:template match="/">
          <html>
                <head>
                    <title>...</title>
                </head>

            <body>
             <table width="1024" border="0" cellspacing="0" cellpadding="0">
                  ..........
                  <tr>
                    <td><xsl:apply-templates select="//login_fields"/></td>
//I don't want this transformed here!
                  </tr>
                </table>
</body>
</html>
</xsl:template>

<xsl:template match="login_fields">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
      <xsl:element name="{local-name()}">
            <xsl:apply-templates select="@*|xmlns|
node()[not(self::login_fields)]"/>
      </xsl:element>
</xsl:template>

<xsl:template match="@*|text()">
      <xsl:copy/>
</xsl:template>
</xsl:stylesheet>

When I load the page the section I don't want processed is still being
processed within the document it is contained in, what am I missing here?

regards

Andrew

Mime
View raw message