Hi All,
Below is the XMl and Xslt i am having problem with template.
XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Sheets>
<Sheet Id="Sh1">
<Main Id="M1">
<current>
<title>World</title>
<story>Hello world</story>
</current>
</Main>
<sport Id="S1">
<current>
<title>Boxing</title>
<story>Boxing between A and B</story>
</current>
</sport>
</Sheet>
</Sheets>
XSLT :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="sheet">
<xsl:if test="@id='Sh1'">
<xsl:apply-templates select="/*[@Id='M1']"/>
</xsl:if>
</xsl:template>
<xsl:template match="current">
<xsl:value-of select="title">
<br/>
<xsl:value-of select="story">
</xsl:template>
</xsl:stylesheet>
Below part is not returning the desired result.which should Select Main element.
'<xsl:apply-templates select="/*[@Id='M1']"/>'
I have tired executing Xpath directly in the Editor and its working fine :
/sheets/sheet[@Id='Sh1']/*[@Id='Main']
Can u tell me where i am doing wrong.
Thanks