You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew <an...@gmail.com> on 2006/07/19 16:52:16 UTC
XSL: match all elements except one section... node()[not(self::login_fields)]
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
Re: XSL: match all elements except one section... node()[not(self::login_fields)]
Posted by Andrew <an...@gmail.com>.
Hi Jason,
I have resolved this issue by doing:
<xsl:template match="*">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
Many regards for your reply.
Andrew
On 22/07/06, Jason Johnston <co...@lojjic.net> wrote:
>
> Andrew wrote:
> > Any ideas anyone?
> >
>
> Not totally sure I get what you're after, but my best guess is maybe you
> just want to do an <xsl:copy-of select="login_fields" /> in your first
> stylesheet? That copies it through untouched.
>
>
> >
> > On 19/07/06, *Andrew* <andrewmadu@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> > 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
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
Re: XSL: match all elements except one section... node()[not(self::login_fields)]
Posted by Jason Johnston <co...@lojjic.net>.
Andrew wrote:
> Any ideas anyone?
>
Not totally sure I get what you're after, but my best guess is maybe you
just want to do an <xsl:copy-of select="login_fields" /> in your first
stylesheet? That copies it through untouched.
>
> On 19/07/06, *Andrew* <andrewmadu@gmail.com
> <ma...@gmail.com>> wrote:
>
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: XSL: match all elements except one section... node()[not(self::login_fields)]
Posted by Andrew <an...@gmail.com>.
Any ideas anyone?
regards
Andrew
On 19/07/06, Andrew <an...@gmail.com> wrote:
>
> 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
>