[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] HTML within an element
Subject: Re: [xsl] HTML within an element From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 23 Jul 2001 17:58:32 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] HTML within an element, Nathan Shaw | Thread | Re: [xsl] HTML within an element, Jeni Tennison |
RE: [xsl] captured in a <xsl:for-ea, Michael Kay | Date | RE: [xsl] Stripping whitespace with, Michael Kay |
Month |
Keywords