[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

excluding nodes from an xsl template

Subject: excluding nodes from an xsl template
From: Kevin.Hooke@xxxxxxxx
Date: Fri, 7 Jul 2000 08:33:22 -0700
xslt exclude node

Hi - we need an XPATH expression for an XSL template that selects a set of nodes
from an XML document, but excludes some nodes from the results.

We are using this to transform an XHTML document to different outputs for
different devices, eg, HTML, WML, simple (HTML3.2) HTML etc. We are using Cocoon
to provide the XSLT transformation engine.

For example - if this is the XHTML:

<?xml version="1.0"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="../xsl/test_default.xsl" type="text/xsl"?>
<html>
<head>
     <title>DM Work Management Logon</title>
</head>

<link rel="stylesheet" type="text/css" href="../css/style5.css"></link>
<body>
<xsp>
 //do some java XSP here...
</xsp>
<p>some text in the page etc</p>
</body>
</html>

... and this is our default stylesheet that if the client is an HTML4.0 browser,
the XHTML is copied through to the output almost as is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
     <xsl:apply-templates/>
</xsl:template>
<xsl:template match="* | text() | @*">
     <xsl:copy>
          <xsl:apply-templates select="@*"/>
          <xsl:apply-templates/>
     </xsl:copy>

</xsl:template>
</xsl:stylesheet>


.... our problem is that if we embed XSP for dynamic content into our source
XHTML, then this content is being copied through to the output as well, andwe
need to exclude this output.

So we need to modify the template match pattern to exclude nodes like <xsp> from
the results set.

We've already tried things like
- <xsl:template match="* and self::not(xsp)">
- <xsl:template match="* and not(xsp)">
- <xsl:template match="node() and not(xsp)">

I think we're looking along the right lines, but we're struggling with the xpath
 syntax for the match we need.

Can anyone help....!

Thanks,
Kevin Hooke




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.