Hi all,
Xml file
-------------
<?xml version="1.0" encoding="UTF-8"?>
<emc>
<roottopic roottopicname="Engineering">
<content>
<id>37</id>
<questions>
<text> ssss</text>
</questions>
<answers>
<text>I am the
answer text</text>
<links
linktext="1. Back Burner" href="http://www.cdc.gov"/>
<text> 2 answertext</text>
<links linktext="2. Back Burner"
href="http://www.cdc.gov"/>
<text>answer text continuess..........</text>
</answers>
</content>
<content>
<id>57</id>
<questions><text> what is the II question?</text>
</questions>
<answers>
<text>This is 3 answer
text</text>
<links linktext=" 3.Back
Burner" href="http://www.cdc.gov"/>
<text>This is 4 answer text</text>
<links linktext="4. Back
Burner" href="http://www.cdc.gov"/>
</answers>
</content>
</roottopic>
<roottopic roottopicname="Purchase">
<content>
<id>17</id>
<questions>
<text>
ssss</text>
</questions>
<answers>
<text>I am the 1 answer text</text>
<links linktext="1. Back Burner" href="http://www.cdc.gov"/>
<text> 2 answertext continues.........</text>
<links linktext="2. Back Burner"
href="http://www.cdc.gov"/>
</answers>
</content>
<content>
<id>47</id>
<questions><text> what is the II
question?</text>
</questions>
<answers>
<text>This is 3
answer text</text>
<links
linktext=" 3.Back Burner" href="http://www.cdc.gov"/>
<text>This is 4 answer text</text>
<links
linktext="4. Back Burner" href="http://www.cdc.gov"/>
</answers>
</content>
</roottopic>
</emc>
xsl File
-----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="emc/roottopic">
<xsl:apply-templates select="content"/>
</xsl:for-each></body>
</html>
</xsl:template>
<xsl:template match="content">
<xsl:apply-templates select="questions"/>
<xsl:apply-templates select="answers"/>
</xsl:template>
<xsl:template match="questions">
<xsl:apply-templates select="text"/>
<xsl:apply-templates select="links"/>
</xsl:template>
<xsl:template match="answers">
<xsl:apply-templates select="text"/>
<xsl:apply-templates select="links"/>
</xsl:template>
<xsl:template match="text">
<p>
<h2><xsl:value-of select="."/></h2>
</p>
<br></br>
</xsl:template>
<xsl:template match="links">
<xsl:variable name="hrefvalue">
<xsl:value-of select="@href"/></xsl:variable>
<a href="{$hrefvalue}">
<xsl:value-of select="@linktext"/></a>
</xsl:template>
</xsl:stylesheet>
On the above xml how can i get the values of text and links elements inside
the questions and answers tags
on the order they appear on xml. Right now my xsl looks like this and it
gets all the text element values as a collection and links value as a
collection. Any help would be greatly appreciated.
Thanks,
selva
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list