RE: [xsl] HTML inside XML using XSLT

Subject: RE: [xsl] HTML inside XML using XSLT
From: Lucas Gonçalves Grossi <lggrossi@xxxxxxxxxx>
Date: Fri, 23 Nov 2007 21:47:22 -0200
Hi,
First thanks for the help. But didn't work :( I tried the two solutions: with
the first it just appear the source code of the html inside the output. With
the second, I transformate my html to xhtml using tagsoup (jtidy couldn't make
the transformation), but nothing appears inside the output.
This is one part of my xslt file and I'm using stylus studio 2007 enterprise
edition release 2 to generate de xsl:

<xsl:for-each select="question">
<li value="0">
<xsl:value-of select="@titleQuestion"/>
<ul>
<xsl:for-each select="metric">
<li value="0">
<xsl:value-of select="@titleMetric"/>
</li>
<li value="0">
    <xsl:copy-of select="myfile.xhtml"/>
</li>
</xsl:for-each>
</ul>
<div>
<xsl:for-each select="metric"/>
</div>
</li>
</xsl:for-each>

I tried to put instead of xsl:copy-of, <xsl:value-of
select="unparsed-text('myfile.html')">
Didn't work for the two.

What can I do?


Thanks,
Lucas G. Grossi




> 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: [xsl] 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

Current Thread