Haritz
Haritz

Reputation: 1752

XSL Transformation and XPath

I am having problems running the next XSL stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="Blokea">
    <xsl:param name="Handiena" select="Blokea/Bl2">
       <xsl:if test="Blokea/Bl1>Blokea/Bl2">
    <xsl:param name="Handiena" select="Blokea/Bl1">
         <xsl:value-of select="$Handiena"/>
      </xsl:if>
</xsl:template>
</xsl:stylesheet>

over the next XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Erroa>
    <Blokea>
        <Bl1>20</Bl1>
        <Bl2>10</Bl2>
    </Blokea>
</Erroa>

How can I solve it?

Upvotes: 1

Views: 79

Answers (1)

hroptatyr
hroptatyr

Reputation: 4829

I think what you're trying to do is this:

<xsl:template match="Blokea">
  <xsl:param name="Handiena">
     <xsl:choose>
       <xsl:when test="./Bl1 &gt; ./Bl2">
         <xsl:value-of select="./Bl1"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="./Bl2"/> 
       </xsl:otherwise>
    </xsl:choose>
 </xsl:param>
 <xsl:value-of select="$Handiena"/>
</xsl:template>

Correct me if I'm wrong.

Upvotes: 1

Related Questions