Subject: Re: [xsl] select all answers belongs to one question from xml with xpath From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 30 Jun 2005 22:08:29 +0200 |
i have a set of questions and for each question a set of answers (4 answers )stored in xml file as each each answer has an attribute as a reference to the question that it belogs to as following :
<xsl:template match="*[ques]"> <h1>My questions</h1> <xsl:apply-templates select="ques"/> </xsl:template>
<xsl:template match="question"> <h2><xsl:apply-templates/></h2> key method: <ol> <xsl:for-each select="key('answer',@id)"> <li><xsl:apply-templates/></li> </xsl:for-each> </ol> xpath method: <ol> <xsl:for-each select="//answer[@question=current()/@id]"> <li><xsl:apply-templates/></li> </xsl:for-each> </ol> </xsl:template>
regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Ceterum censeo XML omnibus esse utendum
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] select all answers belongs to, 04083259 | Thread | [xsl] XSL related activities at Ext, B. Tommie Usdin |
Re: [xsl] XSLT2/XPath2 books, Dimitre Novatchev | Date | [xsl] Re: [exslt] Re: Re: [xsl] Imp, Dimitre Novatchev |
Month |