[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] super basic xsl question


Subject: RE: [xsl] super basic xsl question
From: "Pawson, David" <David.Pawson@xxxxxxxxxxx>
Date: Fri, 14 Jan 2005 08:33:55 -0000

    -----Original Message-----
    From: Jeb Boniakowski


    Thanks for the reply.  This is the kind of info I'm having
    a hard time getting from like w3schools.com, etc.

Try one of the books, it might be more reliable.



    In general though, on the topic of apply-templates, there
    is a larger issue that trips me up.  Oftentimes, it seems
    that I mess up my set of templates in such a way that
    things get matched and copied to the output tree
    automatically, even though they are matched.  To deal with
    this, I've been sticking a template at the top of my sheets that is:

    <xsl:template match="text()"/>

    Is this bad style?  Is it a crappy hack to deal with messed
    up templates?  Or is it the correct way to suppress default rules?

Don't suppress them, find out what they do, and use them or replace them?
Their basic operation is to copy the input document text to the output,
then process the child of the element you forgot to provide a template for.
http://www.w3.org/TR/xslt#built-in-rule

I trip over the same way, so all my new stylesheets have

  <xsl:template match="*">
  <xsl:message>
    *****<xsl:value-of select="name(..)"/>/{<xsl:value-of
select="namespace-uri()"/>}<xsl:value-of select="name()"/>******
    </xsl:message>
</xsl:template>

This prompts me to write a template for the A/B element that I'm not yet
processing.
When I've finished, I can write

<xsl:template match="*"/>

which again replaces or overrides the defaults, and blocks processing (if
that's what is needed)





HTH DaveP.

** snip here **

--
DISCLAIMER:

NOTICE: The information contained in this email and any attachments is
confidential and may be privileged.  If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.

RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants.  However, it
cannot accept any responsibility for any  such which are transmitted.
We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk


Current Thread