xsl-list
[Top] [All Lists]

RE: Removing unwanted tag content from xsl output to html response.

2003-03-11 20:48:12
Try moving the 

<xsl:template match="*" /> 

to the top of the file and adding

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

With the suppression of match="*" there's no rule to walk the XML document tree 
from the root node to the /root/tables node

HTH,

Ken Ross
Ph: +61 7 32359370
Mob: +61 (0)419 772299
Email: Ken(_dot_)Ross(_at_)iie(_dot_)qld(_dot_)gov(_dot_)au


-----Original Message-----
From: Simon Kelly [mailto:kelly(_at_)ipe(_dot_)fzk(_dot_)de]
Sent: Tuesday, 11 March 2003 7:07 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Removing unwanted tag content from xsl output to html
response.


Hi all,

I am having a problem with a template to pass over some unused tags without
printing them out to the responce OutputStream in html.

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="*" />

</xsl:stylesheet>

Institut fuer
Prozessdatenverarbeitung
und Elektronik,
Forschungszentrum Karlsruhe GmbH,
Postfach 3640,
D-76021 Karlsruhe,
Germany.

Tel: (+49)/7247 82-4042
E-mail : kelly(_at_)ipe(_dot_)fzk(_dot_)de


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

IMPORTANT: This email (including any attachments) may contain confidential,
private or legally privileged information and may be protected by copyright. 
You may
only use it if you are the person(s) it was intended to be sent to and if you 
use it in an
authorised way. No one is allowed to use, review, alter, transmit, disclose, 
distribute,
print or copy this e-mail without appropriate authority.
 
If this e-mail was not intended for you and was sent to you by mistake, please
telephone or e-mail me immediately, destroy any hard copies of this e-mail and 
delete
it and any copies of it from your computer system. Any legal privilege and 
confidentiality attached to this e-mail is not waived or destroyed by that 
mistake.
 
It is your responsibility to ensure that this e-mail does not contain and is 
not affected
by computer viruses, defects or interference by third parties or replication 
problems
(including incompatibility with your computer system).




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



<Prev in Thread] Current Thread [Next in Thread>