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

Re: Still Testing!!

Subject: Re: Still Testing!!
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Sat, 12 Feb 2005 08:25:10 -0800 (PST)
Re:  Still Testing!!
Hi Adam,
  For your problem, how the xsl:if test will look
like, will depend on, what is the context node..?

Here is an example -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
<xsl:output method="text" />

<xsl:template match="tree_node[@id = '8']">
 <xsl:if test="parent::tree_node[@id = '7']">
   yes
 </xsl:if>
</xsl:template>

</xsl:stylesheet>

The above template rule will execute for node ->
tree_node with id = 8. The xsl:if test will evaluate
to true, because node's parent is tree_node with id =
7.

Regards,
Mukul
  
--- Adam J Knight <adam@xxxxxxxxxxxxxxxxx> wrote:

> <?xml version="1.0"?>
> <tree>
>   <tree_node id="7" value="Test">
>     <tree_node id="8" value="Test Sub"/>
>       <tree_node id="9" value="Test Sub One">
>       <tree_node id="10" value="Test Sub Two">
>         <tree_node id=11 value=Test Sub Three/>
>       </tree_node>
>     </tree_node>
>   </tree_node>
> </tree>
> 
> Given the structure above I am trying to use an
> xsl:if test that tests
> whether a node is an immediate child of a particular
> node. ie: Node with id
> 8 Is the immediate child of node with id of 7.
> 
> <xsl:if test="parent::tree_node[@id=$c_node]">
> 
> </xsl:if>
> 
> Above is my attempt to achieve this, but doesnt
> appear to work.
> 
> Thanks to those who have responded to my previous
> posts, I am still very
> green to xsl so your insights are appreciated and
> are slowly helping me
> understand this technology. 
> 
> Cheers, 
> Adam 
>  
> NB: "Pray as if everything depended upon God and
> work as if everything
> depended upon man."


		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page  Try My Yahoo!
http://my.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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