Subject: RE: HTML inside XML using XSLT
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 23 Nov 2007 19:59:35 -0000
|
In XSLT 2.0 you can read the HTML using unparsed-text() and then write it
with disable-output-escaping.
A cleaner solution is to read it as XML (typically converting it using
JTidy, or on-the-fly using TagSoup) and then you can output it directly
using xsl:copy-of.
The choice depends on your processing environment.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Lucas Gongalves Grossi [mailto:lggrossi@xxxxxxxxxx]
> Sent: 23 November 2007 18:52
> To: xsl-list
> Subject: HTML inside XML using XSLT
>
> Hi,
>
> I'm trying to do a program in XSLT that has a xml and a html
> files. The xml is like this:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <?xml-stylesheet type="text/xsl" href="F-GESGQM.xsl"?>
> <!-- New document created at Thu Oct 18 08:53:18 CEST 2007 -->
>
> <gqmroot titleRoot="F-GES GQM">
> <goal titleGoal="G.1. Aumento della qualit` esterna">
> <question titleQuestion="Q.1.1. Quanti bug
> trova lutente? Quanti sono ad alta priorit`?">
> <metric
> titleMetric="M.1.1.1. Numero di
> bug riportati nell'intervallo di tempo considerato, divisi
> per centro di costo e per prodotto."
> ChartLink="gesGQMReport_M111.html">
> </metric>
>
> Now, when I do this, in the output of the xslt appears just
> the name of the html file. But instead of the name, I want
> that appears the content of the html. This html is a file
> whith figures in png. Is a java script that gets the png
> files from a folder and show them in a url, that is a html
> file. This is just the beginning of the html file:
>
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html;
> charset=windows-1252"> <SCRIPT language=JavaScript> var
> ie55up = true </SCRIPT> <![endif]--> <SCRIPT language=JavaScript>
> function fixPNG(myImage) // correctly handle PNG
> transparency in Win IE 5.5 or higher.
> {
> if (window.ie55up)
> {
> var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
> var imgClass = (myImage.className) ? "class='" +
> myImage.className + "' " : ""
> var imgTitle = (myImage.title) ? "title='" +
> myImage.title + "' " : "title='" + myImage.alt + "' "
> var imgStyle = "display:inline-block;" +
> myImage.style.cssText
> var strNewHTML = "<span " + imgID + imgClass + imgTitle
> strNewHTML += " style=\"" + "width:" + myImage.width
> + "px; height:" + myImage.height + "px;" + imgStyle + ";"
> strNewHTML +=
> "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
> strNewHTML += "(src=\'" + myImage.src + "\',
> sizingMethod='scale');\"></span>"
> myImage.outerHTML = strNewHTML
> }
> }
> </SCRIPT>
>
> Another problem is that the XSLT gets the value of the chartlink node:
> <xsl:value-of select="@ChartLink"/>
> XSLT make this for each metric of the xml file.
>
> Does anyone knows how to do it??
>
>
> Thanks a lot,
> Lucas G. Grossi
|