Re: MSXML 3.0 XSLT. Does it work?

Subject: Re: MSXML 3.0 XSLT. Does it work?
From: Jeni Tennison <Jeni.Tennison@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Jul 2000 12:12:04 +0100
Sotiris,

>If understand that if the template rules don't match at all, then default
>template rules apply (another subscriber explained this to me).  Is it
>possible to switch these rules off?

You can 'switch these rules off' by not applying templates to elements that
you don't want to be matched on.  So, in your example:

     <a>
          <b>Hello</b>
          <c>There</c>
          <d>GoodBye</d>
     </a>

Instead of applying templates to all the children using:

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

Then apply the templates to only the children you're interested in, using:

    <xsl:template match="a">
      <xsl:apply-templates select="d" />
    </xsl:template>

If you find it easier to identify which elements you *don't* want to be
processed, then you can either deliberately not select them within the
select attribute of the xsl:apply-templates element, or alternatively
create templates that do nothing for those particular elements, e.g.:

    <xsl:template match="b" />
    <xsl:template match="c" />

Finally, you can create templates that mimic the built-in templates but do
nothing:

    <xsl:template match="*" />

so that by default, if an element doesn't match any template, then it isn't
processed at all.  Be careful doing this, though, if you *are* interested
in the content of the elements - they have interesting sub-elements, say,
because empty templates mean that templates aren't applied to the children
of the ignored elements.

I hope this helps,

Jeni

Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 ? Fax 0115 9061304 ? Email
jeni.tennison@xxxxxxxxxxxxxxxx



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


Current Thread