Hallo,
I have a very basic xml file and a correspondent xsl file. How would like to use the choose expression in order to check if the content is = to a certain string. The result I get it is always based on the "otherwise" part, even when in fact I would expect that the expression in my choose would return a true value.
Here the two files:
xml
xls
Am I missing something
I have a very basic xml file and a correspondent xsl file. How would like to use the choose expression in order to check if the content is = to a certain string. The result I get it is always based on the "otherwise" part, even when in fact I would expect that the expression in my choose would return a true value.
Here the two files:
xml
Code:
<chat>
<chatinput>
<speaker>BoxBrain</speaker>
<text>Don't understand you</text>
</chatinput>
<chatinput>
<speaker>Administrator</speaker>
<text>Compile</text>
</chatinput>
<chatinput>
<speaker>BoxBrain</speaker>
<text>Don't understand you</text>
</chatinput>
<chatinput>
<speaker>Administrator</speaker>
<text>Compile</text>
</chatinput>
<chatinput>
<speaker>BoxBrain</speaker>
<text>Don't understand you</text>
</chatinput>
</chat>
xls
Code:
<html xsl:version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<body>
<xsl:for-each select="chat/chatinput">
<xsl:choose>
<xsl:when test="speaker = BoxBrain">
<div style="background-color:yellow;color:white;padding:4px">
<span style="font-weight:bold">
<xsl:value-of select="speaker"/>
</span>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="text"/>
</div>
</xsl:when>
<xsl:otherwise>
<div style="background-color:red;color:white;padding:4px">
<span style="font-weight:bold">
<xsl:value-of select="speaker"/>
</span>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="text"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</body>
</html>
Am I missing something