This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: unresolved problem using html


[
>>>See the document() function for including additional XML documents.
>>>
>>Unfortunately I've got to include an HTML document  :-( , document is 
>>only reserved to xml
>>
>
>can the html document be a well-formed xml document?
>If not can the html document be an xml document with everything below
>the document element in a CDATA section?
]
longjohn wrote:
>Unfortunately I don't understand what you mean about well-formed
>Consider that HTML could be something like :

><a href="http://www.polito.it"; class="norm" target="_top">Politecnico
di 
>Torino</a> <br />
><a href="http://www.polito.it/dipartim/autoinfo/itindex.html"; 
>class="norm" target="_top">Dipartimento di Automatica e Informatica</a>
><br /> Corso Duca degli Abruzzi 24 <br />Torino , Italy

>and consider also that I can manipulate it before sending it to xsl 
>because I call the string from a JSP page (of course I can't transform 
>it  into pure XML because the string could contain many kinds of HTML 
>tags! So I can add something as head or tale of the string)
       


okay I don't see anything above that would break an xml parser, unless
of course there wasn't a document element for this(in which case I think
any html parser would break too) 
that said here's some possibilities:
send in the html as a parameter to your xslt. 

<root>
<a href="http://www.polito.it"; class="norm" target="_top">Politecnico di

Torino</a> <br />
<a href="http://www.polito.it/dipartim/autoinfo/itindex.html"; 
class="norm" target="_top">Dipartimento di Automatica e Informatica</a>
<br /> Corso Duca degli Abruzzi 24 <br />Torino , Italy
</root>

if the parameter was named htmlinclude

then you would have this in your xslt

<xsl:param name="htmlinclude"/>

<xsl:template match="/">
<xsl:copy-of select="$htmlinclude"/>
</xsl:template>

in this way you don't even have to use a node-set function cause the
root tag will be ignored by the browser.

?possibility 2

have a tag in your xml 
<include href="myhtml.xml"/>

then you make <xsl:param name="myhtml" select="document(@href)"/>
<xsl:copy-of select="$myhtml/root/*"/>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]