RE: [xsl] extracting HTML elements from document created by saxon:parse

Subject: RE: [xsl] extracting HTML elements from document created by saxon:parse
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 19 Sep 2006 16:06:16 +0100
(a) to get <br/> rather than <br> in the output, don't use the HTML output
method.

(b) whereas your embedded document has the < characters correctly escaped as
&_lt;, it appears to contain & unescaped - that is, it contains &_#160;
where it should contain &_amp;#160; (Underscores added to prevent mailer
corruption). 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Dharshana S Van Der Bona [mailto:dharshanav@xxxxxxxxx] 
> Sent: 19 September 2006 15:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] extracting HTML elements from document created 
> by saxon:parse
> 
> Hi All,
> 
> I'm suing the following template to extract all the html tags 
>  that is not <a> in to the xsl output.
> 
>  <xsl:variable name="htmlContent" 
> select="saxon:parse(concat('&lt;!DOCTYPE tag [&lt;!ENTITY 
> nbsp 
> ''&#160;''&gt;]&gt;',concat(concat('&lt;tag&gt;',text()),'&lt;
> /tag&gt;')))"/>
>   <xsl:apply-templates select="$htmlContent"  />
> 
> 
>     <xsl:template match="tag/*[name() != 'a']" >
>         <xsl:element name="{name()}">
>         <xsl:copy-of select="@*|text()|node()"/>
>         </xsl:element>
>     </xsl:template>
> 
> But it is not properly extracting tags such as <br/> and only 
> outputs <br> Is there a way to fix this?
> 
> Also is there a way to get around the parser complaints of 
> &nbsp; not declared exception?
> 
> 
> Thanks,
> Dharshana

Current Thread