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

RE: Removing unwanted tag content from xsl output to h

Subject: RE: Removing unwanted tag content from xsl output to html response.
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 11 Mar 2003 11:22:26 +0200
snuff machinery club version
Hi,

> I have the following xsl sheet (Very simple) and when I do 
> not include the
> <xsl:template match="*" /> I get my output the way I want it, 
> but with all
> the remainder of the xml as text at the bottom of the screen. 
>  If I include
> the match="*" template I get nothing at all.
> 
> Any pointers would be handy. (NOTE: All paths in templates 
> are absolute)
> 
> Cheers
> 
> Simon
> 
> [CODE]
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>     <xsl:output method="html"/>
> 
>     <!-- template rule matching source /root/tables element -->
>     <xsl:template match="/root/tables">
>         <h1>Avaliable subsystems and signals</h1>
>         <table border="1" cellpadding="3">
>             <tbody>
>                 <tr>
>                     <th>Subsystem</th>
>                     <th>Time Select (Not implemented)</th>
>                     <th>Signal Select</th>
>                 </tr>
>                 <xsl:apply-templates select="/root/tables/table"/>
>             </tbody>
>         </table>
>     </xsl:template>
> 
>     <xsl:template match="/root/tables/table">
>         <tr>
>             <td>
>                 <b><xsl:value-of select="@name"/></b>
>             </td>
>             <td width="50" bgcolor="red">
>                 <b><u>Time stamp not implemented yet!</u></b>
>             </td>
>             <td>
>                 <xsl:for-each select="column">
>                     <xsl:apply-templates
> select="/root/tables/table/column"/>
>                 </xsl:for-each>
>             </td>
>         </tr>
>     </xsl:template>
> 
>     <xsl:template match="/root/tables/table/column">
>         <b>Click to select :</b><xsl:value-of select="."/><br/>
>     </xsl:template>
> 
> <!-- This is the line causing the problem -->
>     <xsl:template match="*" />

When the processing starts, the build-in template for "/" will kick in, and process all child nodes. The template above will be used to process the "root" element, thus the other templates above will never be used as it does not select any nodes for processing. If you want to process just "/root/tables", then e.g. replace the template causing problems with

<xsl:template match="/">
  <xsl:apply-templates select="root/tables" />
</xsl:template>

Cheers,

Jarno - SITD: Snuff Machinery (Club Version)

 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.