I'm learning XSLT via "Beginning XSLT 2.0 From Novice to Professional". Following the source code from the book, I've tried to compile this in Visual Studio 2008 TS:
<xsl:template match="Program">
<div>
<p>
<xsl:if test="@flag">
<img src="{if (@flag = 'favorite') then 'favorite' else 'interest'}.gif"
alt="[{if (@flag = 'favorite') then 'Favorite' else 'Interest'}]"
width="20" height="20" />
</xsl:if>
<!-- ... -->
</p>
</div>
</xsl:template>
The XML data is as follows:
<Channel>
<Name>BBC1</Name>
<Program rating="5" flag="favorite">
<!-- ... -->
</Program>
<!-- ... -->
</Channel>
However, when I compile this code I get:
'string(if (@flag = 'favorite') then 'favorite' else 'interest')' is an invalid XPath expression.
I've checked the website of the book looking for an errata, unfortunately this hasn't been covered. Any pointers would be fantastic.