I have to select the values based on conditions. If Author name = Bero, it should display roles of 1st author, if Author name= Aurora it should display all topics.But I'm not getting expected output. Here is my XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:regexp="http://exslt.org/regular-expressions"
version="1.0">
<xsl:template match="/">
<xsl:variable name="Store">
<Bookstore>
<Author name="Bero">
<topic>Athletics</topic>
</Author>
<Author name="ABC">
<topic>Sports</topic>
</Author>
</Bookstore>
</xsl:variable>
<xsl:for-each select="$Store/Bookstore/Author">
<xsl:choose>
<xsl:when test="contains($Author ='Bero')">
<xsl:variable name="Store" select="string($Store/Bookstore/Author[@name='Aurora']/u/text())"/>
</xsl:when>
<xsl:when test="contains($Author ='Aurora')">
<xsl:variable name="Store" select="string($Store/Bookstore/Author[@name='Aurora'and @name='Bero']/u/text())"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Expected Partial Output1 when 1st test case is executed:
<topic>Athletics</topic>
Expected Partial Output2:
<topic>Athletics</topic>
<topic>Sports</topic>