RE: Xsl problem (template matching)

Subject: RE: Xsl problem (template matching)
From: Jim Michael <JMichael@xxxxxxx>
Date: Mon, 20 Dec 1999 08:42:03 -0500
In order for your template to match under all nodes, would you not have to
use // as in:

<xsl:template match="//display-type">
	<!--rules here -->
</xsl:template>

If your display-type node sits directly beneath another node you are using a
template match for, then the // isn't necessary. Or is the above approach
poor form? I can think of instances where the // might be useful for
extracting deeply nested nodes of interest. Thanks.

Cheers,

Jim

> Don't worry, that's how XSL works. You can declare template 
> rules so that
> they will only fire if elements are in particular contexts, 
> or so that do
> they do so all the time.
> 
> For example:
> 
> <xsl:template match="display-type">
> <!--rules here -->
> </xsl:template>
> 
> will fire for all display-type elements in your document, whereas:
> 
> <xsl:template match="display-type[@value='bullets']">
> <!--rules here -->
> </xsl:template>
> 
> and
> 
> <xsl:template match="example/display-type">
> <!--rules here -->
> </xsl:template>
> 
> will only fire in particular contexts.
> 
> I hope that helps. Do take a look at the XPath spec @ 
http://w3.org/TR/xpath

Richard

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of bhavesh bhanushali
Sent: Saturday, December 18, 1999 12:16 AM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Xsl problem (template matching)


Hi

I am newbie in xsl.
My problem is:-
I want to apply a particular template where ever that particular node exist
i.e independent of its parent elements.


for e.g
<example>
<name>xxxy</name>
<display-type value="bullets">
<training>xyz</training>
</display-type>
<section>aaaa</section>
<display-type value="bullets">
<topic>Hello</topic>
</display-type>
</example>

I want to match (display-type) node and use the same template whereever it
is present.
I hope u understand. Can Anyone suggest the solution.
Thanks in Advance

With Regards
Bhavesh

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001


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


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


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


Current Thread