You need to show us your XML source structure.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Sanjukta Mitra [mailto:sanmit27(_at_)yahoo(_dot_)com]
Sent: 03 February 2005 21:44
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] New to XSLT: problem with Xpath & traversing
ancestor axis
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
[(_at_)ans='yes']][1]"/>
<xsl:param name="Cnt"
select="count(ancestor::decisiontree_answer[(_at_)answer='no'][coun
t(ancestor::decisiontree_question[.=$stop_question]
>0])"/>
<xsl:apply-templates
select="./ancestor::decisiontree_question[../decisiontree_answ
er[(_at_)answer='yes']][1]/decisiontree_answer[(_at_)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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--