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

New to XSLT: problem with Xpath & traversing ancestor

Subject: New to XSLT: problem with Xpath & traversing ancestor axis
From: Sanjukta Mitra <sanmit27@xxxxxxxxx>
Date: Thu, 3 Feb 2005 13:44:01 -0800 (PST)
xslt ancestor
Hi,

I am fairly new to XSLT and am having trouble figuring
out the XPath related to traversing the ancestor
axis.Can anyone help me out with this?

Thanks
Sanjukta

(The source document is a binomial XML decisiontree,
where each question has two answers and each answer
can lead to further questions or terminal nodes.) 

I am trying to accomplish the following steps:

1.traverse the ancestor axis from the current node and
select the first question node whose parent is an
answer node with attribute  @ans='yes'.Storing this
question node in parameter stop_question.

2.Defining the param Cnt that counts the number of
decisiontree_answer{ with attribute @ans='no'}nodes
preceding the current node and following the
stop_question node. I want the counting of answer
nodes to stop once the stop question is reached.

3.Applying a template to the decisiontree_answer node
with attribute @ans='no' that is the immediate child
of the stop_question node

Here goes the code:

<xsl:template match="enumerated_type_ptr">

<xsl:param name="stop_question"
select="ancestor::decisiontree_question[../decisiontree_answer[@ans='yes']][1]"/>

<xsl:param name="Cnt"
select="count(ancestor::decisiontree_answer[@answer='no'][count(ancestor::decisiontree_question[.=$stop_question]
&gt;0])"/>


<xsl:apply-templates
select="./ancestor::decisiontree_question[../decisiontree_answer[@answer='yes']][1]/decisiontree_answer[@answer='no']"
mode="No_Ptr">

<xsl:with-param name="X1"
select="($XT)-80-($Cnt)*140"/>
<xsl:with-param name="Y1" select="($YT)-78"/>
</apply-templates>

</template>
       


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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.