xsl-list
[Top] [All Lists]

RE: Embedding html within xml

2004-03-11 12:54:10
-----Original Message-----
From: John Reid

I like that idea copy-of. But have not yet got it to work


Hi,

I guess ultimately the most elegant way to deal with it would be to provide
a few basic templates like

<xsl:template match="rule">
  <li class="strong"><xsl:value-of selecy="@type" /><br/>
    <span class="goldmedium"><xsl:apply-templates select="node()" /></span>
  </li>
</xsl:template>

<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()" />
  </xsl:copy>
</xsl:template>

then, this

      <ul>
              <xsl:for-each select="rules/rule">
          <li class="strong"><xsl:value-of select="@type" /><br/>
              <span class="goldmedium"><xsl:value-of select="."
/></span></li>
      </xsl:for-each>
      </ul>


becomes simply

<ul><xsl:apply-templates select="rules/rule" /></ul>

and, no matter what other nodes are nested in there somewhere, they will
always be copied along in the correct order.

Hope this helps!

Cheers,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>