Re: [xsl] handling embedded XML tags

Subject: Re: [xsl] handling embedded XML tags
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 02 Oct 2002 00:37:31 -0400
Mick,

At 11:17 PM 10/1/2002, you wrote:
What I am trying to achieve is this:

<p>Some text here <span>emphasised words</span> and more text here</p>

So, my question is, how can I apply the 'emphasis' template in an 'inline'
manner to elements 'embedded' inside other elements?

By doing this:


<xsl:template match="para">
  <p>
  <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="emphasis">
  <span>
  <xsl:apply-templates/>
  </span>
</xsl:template>

Forget value-of until you've mastered working all the way through the node tree applying templates (you'll get the value-of at the bottom in the text node). Read up on the built in templates and how the processor traverses the tree by default. Soon it will click.

Hope this is clear.

Very. :-)


Cheers,
Wendell


___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau


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



Current Thread