[xsl] HTML within an element

Subject: [xsl] HTML within an element
From: Nathan Shaw <n8_shaw@xxxxxxxxx>
Date: Mon, 23 Jul 2001 09:32:50 -0700 (PDT)
I am still having problems grabbing the text of an
element if it contains HTML. i.e.

External DTD declaration:
<!ELEMENT SubSectionText (#PCDATA)>

XML:
<Section Title="Mission"
URL="StrategicVision.htm#mission">
    <SectionText>Conduct basic and applied research to
support human 
exploration of <em>space</em> and to take advantage of
the <strong>space environment</strong> as a 
laboratory for <a href="test.htm">scientific</a>,
technological, and commercial 
research.</SectionText>
</Section>

XSL:
<xsl:template match="SectionText">
<xsl:if test="string-length(text()) >
0"><p><xsl:copy-of select="text()" /></p></xsl:if>
</xsl:template>

When I try to pull out the text of the SectionText
element, I get an error "Element invalid according to
DTD. Expecting #PCDATA."

I have also tried changing the XSL to use:

<xsl:template match="SectionText">
<xsl:if test="string-length(text()) >
0"><p><xsl:copy-of select="." /></p></xsl:if>
</xsl:template>

But, I get the same error. Do I have to define a
template for every single possible HTML element that
could be used within the SectionText element (B,
STRONG, I, EM, A, etc...)????

Nate

=====
----------------------------
Nathan Shaw
Web Applications Developer
iaffect
http://www.iaffectonline.com
http://www.iaffectTV.com
----------------------------

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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


Current Thread