I have an XML as:
- <a>
- <b>
- <c>
- <source>
- <title value ="Apple"/>
- some more tags
- .
- .
- .
- </source>
-
- <source>
- <title value ="Mango"/>
- some more tags
- .
- .
- .
- </source>
-
- <source>
- <title value ="Banana"/>
- some more tags
- .
- .
- .
- </source>
-
- <source>
- <title value =" Grapes"/>
- <some more tags>
- .
- .
- .
- </source>
- </c>
- </b>
- </a>
Based on my input(supose if my input is "title = Banana" I want to display all info related that tag.
I want to display the selected <title> and related <tags> values under that.
eg: Mango, Banana
XSLT :
- <xsl:template match="/">
- <html>
- <body>
- <xsl:apply-templates select="source"/>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="source">
- <xsl:choose>
- <xsl:when test="source[@value='Banana']">
- <xsl:value-of select="source[@value='Banana']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$untitled_section"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
Desire HTML output:
Banana
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......
(some more tags deatils)......