Naor
Naor

Reputation: 24093

xslt exception - attribute value from <xsl: /> tag

I have this XSLT to create rows according to position in for-each:

<xsl:for-each select="Campaign">
  <xsl:choose>
    <xsl:when test="position() = 1">
      <Row>
        <Cell ss:MergeDown="<xsl:value-of select="last()"/>" ss:StyleID="s79">
         <Data ss:Type="String">blabla:</Data>
        </Cell>
        <Cell ss:StyleID="s79">
          <Data ss:Type="String">
            <xsl:value-of select="Text"/>
          </Data>
        </Cell>
      </Row>
    </xsl:when>
    <xsl:otherwise>
      <Row>
        <Cell ss:Index="2" ss:StyleID="s79">
          <Data ss:Type="String">
            <xsl:value-of select="Text"/>
          </Data>
        </Cell>
      </Row>
    </xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

I get an exception because of this line:

<Cell ss:MergeDown="<xsl:value-of select="last()"/>" ss:StyleID="s79">

How can I fix it?

Upvotes: 3

Views: 293

Answers (1)

Kirill Polishchuk
Kirill Polishchuk

Reputation: 56202

Try this:

<Cell ss:MergeDown="{last()}" ss:StyleID="s79">

Upvotes: 4

Related Questions