Hi,
I am having trouble constructing the XPath for this
one. Can anyone help me with this?
Thanks
Sanjukta
I am trying to accomplish the following 2 steps
Step1:(this is working)
The current node is a ptr here.I am trying to traverse
back and find the first question whose parent is an
yes answer.
<xsl:param name="stop_question"
select="./ancestor::decisiontree_question[parent::decisiontree_answer[(_at_)answer='yes']][1]"/>
Eg : If my current node is ptr6, stop_question should
give me Q1a( please refer to the source structure
below)
Step2: (this is not working)
Defining the param Cnt that counts the number of
No answers in between the current node(ptr) and
stop_question.
If the current node is ptr6 this should return 4
Here?s the piece of code that is not working:
<xsl:param name="Cnt"
select="count(ancestor::decisiontree_answer[(_at_)answer='no'][ancestor::decisiontree_question[.=$stop_question]>
0])"/>
Here is a sample structure of the source:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet
href="file://localhost/C:/src/css/decisiontree_xml.css"
type="text/css"?>
<!DOCTYPE decisiontree SYSTEM
"file://localhost/C:/src/dtd/decisiontree.dtd">
<decisiontree>
<decisiontree_question short_question="Q1">
<instruction/>
<decisiontree_answer answer="yes">
<decisiontree_question short_question="Q1A">
<instruction/>
<decisiontree_answer answer="no">
<decisiontree_question short_question="Q1B">
<instruction/>
<decisiontree_answer answer="no">
<decisiontree_question
short_question="Q1C">
<instruction/>
<decisiontree_answer answer="no">
<decisiontree_question
short_question="Q1D">
<instruction/>
<decisiontree_answer answer="no">
<enumerated_type_ptr ptr="ptr6"/>
</decisiontree_answer>
<decisiontree_answer answer="yes">
<enumerated_type_ptr ptr="ptr4"/>
</decisiontree_answer>
</decisiontree_question>
</decisiontree_answer>
<decisiontree_answer answer="yes">
<enumerated_type_ptr ptr="ptr3"/>
</decisiontree_answer>
</decisiontree_question>
</decisiontree_answer>
<decisiontree_answer answer="yes">
<enumerated_type_ptr ptr="ptr2"/>
</decisiontree_answer>
</decisiontree_question>
</decisiontree_answer>
<decisiontree_answer answer="yes">
<enumerated_type_ptr ptr="ptr1"/>
</decisiontree_answer>
</decisiontree_question>
</decisiontree_answer>
<decisiontree_answer answer="no">
<enumerated_type_ptr ptr="ptr5"/>
</decisiontree_answer>
</decisiontree_question>
</decisiontree>
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.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>
--~--