Skip to content

Parameter overcaching #176

@github-nilsson

Description

@github-nilsson

Using the XSLT

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="div">
    <div><xsl:apply-templates/></div>
  </xsl:template>

  <xsl:template match="button">
    <button>
      <xsl:attribute name="style">width:<xsl:call-template name="widthUnit"/>;</xsl:attribute>
      <xsl:text>OK</xsl:text>
    </button>

  </xsl:template>

  <xsl:template name="widthUnit">
    <xsl:param name="width" select="@width"/>

    <xsl:choose>
      <xsl:when test="contains($width, '%') or contains($width, 'px')"><xsl:value-of select="$width"/></xsl:when>
      <xsl:otherwise><xsl:value-of select="$width"/>px</xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

and the input XML

  <div>
  <button width="100%"/>
  <button width="80"/>
  </div>

the output is

<div><button style="width:100%;">OK</button><button style="width:100%;">OK</button></div>

instead of the expected

<div><button style="width:100%;">OK</button><button style="width:80px;">OK</button></div>

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions