[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem:Counting specific type of nodes lying in betwe
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[@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 Heres the piece of code that is not working: <xsl:param name="Cnt" select="count(ancestor::decisiontree_answer[@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|