[xsl] newbie xsl apply-templates nesting question

Subject: [xsl] newbie xsl apply-templates nesting question
From: "John Saylor" <jsaylor@xxxxxxxxxxxxxxxx>
Date: Mon, 7 Jan 2008 17:39:42 -0500
hi

i'm sure there's an easy way to do this, but i'm not getting it. it's
probably been answered many times before, if there's a URL or book for
this, please let me know.

let's say i have some XML like this

<opening>
  <p>this is plain <span class="underline">and this is underlined</span>
and this is plain again</p>
</opening>

and my stylesheet looks like this:

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

<xsl:template match="p">
  <xsl:apply-templates select="span[@class='underline']"/>
  <fo:block><xsl:value-of select="."/><fo:block>
</xsl:template>

<xsl:template match="span[@class='underline']">
  <fo:inline text-decoration="underline"><xsl:vaue-of
select="."/></fo:inline>
</xsl:template>

as you probably can guess, the underlined text comes up first, then the
plain text comes next. i have a feeling i'm misunderstanding something
very fundamental here.

any help is appreciated.


--
\js

Current Thread