Question

<xsl:for-each select="/date/logs">

        <rect>

        <xsl:attribute name="fill">
        red
        </xsl:attribute>

......... This is a portion of my XSL transformation document. When I process it, the red comes out as just

&#10;&#9;&#9;red&#10;&#9;&#9;

Do I need a value-of select and a variable. I'm not that knowledgeable so sorry for my poor explanation.

Could Someone Help me Please, Thanks very much in advance.

Was it helpful?

Solution

You can use literal result elements including attribute values e.g.

<xsl:for-each select="/date/logs">
  <rect fill="red"/>
</xsl:for-each>

If you want or need to populate an attribute value based on a value in your input doc use an attribute value template e.g.

<xsl:for-each select="/date/logs">
  <rect fill="{@color}"/>
</xsl:for-each>

OTHER TIPS

I've now realised the problem was that I had line breaks/spaces. Solved now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top