Q: Inline HTML markup of nested XML elements with XSL

Subject: Q: Inline HTML markup of nested XML elements with XSL
From: "Glenn Cruickshank" <gc@xxxxxxxxxx>
Date: Fri, 29 Oct 1999 11:09:58 -0600
Probably a beginners question, but we were all once beginners....

Using the new IPTC/NAA NITF.DTD in IE5:

I'm trying to use the <em style=> method for doing bolds, italics, drop
caps, etc, and also mark <people> in the text.  Like this:

<p>    <em style="dropcap">W</em>all Street pros call all this backing and
filling a <em style="bold">"trading range,"</em> meaning that stocks trade
up and down but never leave a broad range. <person>Abby Joseph
Cohen</person>, the Goldman Sachs Group investment strategist whose optimism
has come to symbolize the great bull market of the 1990s, has begun warning
clients to expect the market to be more sluggish: <em style="italic"> "Stock
prices will be rising, but at a less exuberant pace," she says.</em></p>

With this style sheet:
<xsl:template match="em">
	  <xsl:choose>
    		<xsl:when test="@style[.='dropcap']">
		<SPAN STYLE="display:inline;font-family:tahoma,arial,sans-serif">
<FONT FACE="Arial Black" SIZE="8">
	     		<xsl:value-of select="." />
		</FONT>
		</SPAN>
	    	</xsl:when>

	    	<xsl:when test="@style[.='bold']">
			<SPAN STYLE="display:inline">
			<B>
	     		<xsl:value-of select="."/>
			</B></SPAN>
    		</xsl:when>
	    	<xsl:when test="@style[.='italic']">
			<I>
	     		<xsl:value-of select="."/>
			</I>
    		</xsl:when>
	  </xsl:choose>
</xsl:template>

<xsl:template match="person">
		<SPAN STYLE="font-size:14pt;font-style:italic;color:green">
			<xsl:value-of />
		</SPAN>
</xsl:template>

</xsl:template><xsl:template match="p[not(@lede)]">
		<xsl:apply-templates /><br />
		<xsl:value-of />
</xsl:template>


Of course, what happens is that the <em> and <person> tagged text gets
processed correctly, but not inline, instead it repeats, so you get this:

W"trading range," Abby Joseph Cohen "Stock prices will be rising, but at a
less exuberant pace," she says. Wall Street pros call all this backing and
filling a "trading range,"meaning that stocks trade up and down but never
leave a broad range. Abby Joseph Cohen, the Goldman Sachs Group investment
strategist whose optimism has come to symbolize the great bull market of the
1990s, has begun warning clients to expect the market to be more sluggish:
"Stock prices will be rising, but at a less exuberant pace," she says.

I know it's the value-of's which are causing the problem, but can find a way
to do this.  There's probably a simple answer, but it's escaping me.  How do
you do inline markup with XSL ?

thx
gc


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


Current Thread