[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: HTML within an element

Subject: Re: HTML within an element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 23 Jul 2001 17:58:32 +0100
html within an xml element
This isn't an XSL question 


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

so SubSectionText can only have text (not elements)


which means that your input

<SectionText>Conduct basic and applied research to
support human 
exploration of <em>space</em>

is not valid.  However XSL does not require valid input, mearly well
formed, so you are OK so long as you use a non-validating parser.



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


That is legal but not what you want to do, it just selects the text
nodes which are children of SectionText


<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>

there are five text node children of SectionText so the p you generate
is the concatenation of those, namely:


Conduct basic and applied research to
support human 
exploration of  and to take advantage of
the <strong>space environment as a 
laboratory for ,
technological, and commercial 
research.

Probably you want

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

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.