Subject: [xsl] New to XSLT: problem with Xpath & traversing ancestor axis From: Sanjukta Mitra <sanmit27@xxxxxxxxx> Date: Thu, 3 Feb 2005 13:44:01 -0800 (PST) |
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] >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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] New to XSLT: problem with, Sanjukta Mitra | Thread | RE: [xsl] New to XSLT: problem wit, Michael Kay |
[xsl] namespace woes, Jerry Orabona | Date | [xsl] Urgent : Nested List Help, Sefa Sevtekin |
Month |