Subject: [xsl] numbering questions and answers entries From: "marvi vokopola" <vmarvi@xxxxxxxxxxx> Date: Mon, 16 Apr 2007 13:02:53 +0200 |
<qandaset defaultlabel="qanda"> <title> questions and answers </title> <qandadiv><title> Common Questions </title> <qandaentry> <question> <par> To be, or not to be? </par> </question> <answer> <par> That is the question. </par> </answer> <answer> <par> That is the question 2. </par> </answer>
</qandaentry> </qandadiv> <qandadiv><title> Deeper Questions </title> <qandaentry> <question> <par> Life? </par> </question> <answer> <par> Never take it for granted. </par> </answer> </qandaentry> </qandadiv> </qandaset>
<qandaset defaultlabel="number"> <title> Another qanda without qanddiv </title> <qandaentry> <question> <par> To be, or not to be? </par> </question> <answer> <par> That is the question. </par> </answer> <answer> <par> That is the question 2. </par> </answer> </qandaentry>
<qandaentry> <question> <par> Life? </par> </question> <answer> <par> Never take it for granted. </par> </answer> </qandaentry> </qandaset>
<xsl:if test="ancestor::*[@defaultlabel]"> <xsl:choose> <xsl:when test="ancestor::*[@defaultlabel='qanda']"> Q:<xsl:value-of select="par"/> </xsl:when>
<!--<xsl:number value="position()" format="1."/> <xsl:value-of select="par"/>-->
<xsl:when test="ancestor::*[@defaultlabel='none']"> <xsl:value-of select="par"/> </xsl:when>
</xsl:choose> </xsl:if> <!--<xsl:value-of select="par"/>-->
</xsl:element> </p> </xsl:template>
<xsl:template match="answer" name="answer"> <p> <xsl:if test="ancestor::*[@defaultlabel]"> <xsl:choose> <xsl:when test="ancestor::*[@defaultlabel='qanda']"> A:<xsl:value-of select="par"/> </xsl:when>
<xsl:when test="ancestor::*[@defaultlabel='number']"> <xsl:value-of select="par"/> </xsl:when>
<xsl:when test="ancestor::*[@defaultlabel='none']"> <xsl:value-of select="par"/> </xsl:when> </xsl:choose> </xsl:if> </p> </xsl:template>
<xsl:template match="qandaset"> <xsl:for-each select="title"> <xsl:call-template name="titles"/> <xsl:choose> <xsl:when test="../qandadiv"> <xsl:for-each select="../qandadiv"> <p> <xsl:for-each select="title"> <xsl:call-template name="titles"/></xsl:for-each> </p>
</xsl:element> <br/> </xsl:for-each> </xsl:otherwise> </xsl:choose>
</xsl:for-each> <xsl:for-each select=".//qandaentry"> <xsl:for-each select="question"> <xsl:call-template name="question"/> </xsl:for-each> <xsl:for-each select="answer"> <!-- <xsl:apply-templates/> --> <xsl:call-template name="answer"/> </xsl:for-each> </xsl:for-each>
Thanks in advance, Suida
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Identifying Namespace Dec, Abel Braaksma | Thread | Re: [xsl] numbering questions and a, Eric Bréchemier |
Re: [xsl] How to move processing in, J. S. Rawat | Date | RE: [xsl] check the type of the $pa, Michael Kay |
Month |