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

RE: template never matches

Subject: RE: template never matches
From: "Merrilees, David" <David.Merrilees@xxxxxxxxxxxx>
Date: Tue, 22 Feb 2011 13:20:32 +0000
RE:  template never matches
Oh yeah, heh, silly me.

Hi Andrew, hope all is well.

Thanks all

-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx]
Sent: 22 February 2011 13:07
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: Merrilees, David
Subject: Re:  template never matches

On 22 February 2011 12:39, Merrilees, David <David.Merrilees@xxxxxxxxxxxx>
> Hi
> I'm having trouble matching a named element vs using node(). Code below. Any
bright ideas?
> Example input:
> <?xml version="1.0" encoding="utf-8"?> <html>
>  <head>
>    <title>Vmtejte</title>
>    <meta charset="utf-8"/>
>  </head>
>  <body id="home">
>  </body>
> </html>

>        <xsl:template match="node() | @*" mode="test">
>                <!-- always matched -->
>                <xsl:sequence select="." />
>        </xsl:template>

That will match <html> and then effectively copy the whole input tree to the
output...  you need to call apply-templates:

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

        <xsl:template match="node() | @*" mode="test">
                        <xsl:apply-templates select="@* | node()"

        <xsl:template match="head" mode="test">
                        <xsl:apply-templates select="@* | node()" mode="test"
                        <link rel="shortcut icon" href="/favicon.ico" />

Andrew Welch

This is a confidential email. Tesco may monitor and record all emails. The
views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8
VAT Registration Number: GB 220 4302 31

Current Thread


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.
First Name
Last Name
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.