|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: New to XSLT: problem with Xpath & traversing anc
You need to show us your XML source structure. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Sanjukta Mitra [mailto:sanmit27@xxxxxxxxx] > Sent: 03 February 2005 21:44 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: 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 > [@ans='yes']][1]"/> > > <xsl:param name="Cnt" > select="count(ancestor::decisiontree_answer[@answer='no'][coun > t(ancestor::decisiontree_question[.=$stop_question] > >0])"/> > > > <xsl:apply-templates > select="./ancestor::decisiontree_question[../decisiontree_answ > er[@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
|
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
|

Cart








