RE: [xsl] Outputing PDF

Subject: RE: [xsl] Outputing PDF
From: Lucas Gonçalves Grossi <lggrossi@xxxxxxxxxx>
Date: Wed, 5 Dec 2007 08:35:00 -0200
The problem is: and don't wanna just take a xml and output a PDF. As you can
see in my code, i have this operation:
<xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/>

My xsl file get a xml and a html as input, and output a html. How can I use
XSL-FO to get this two files, xml and html, and put in one PDF? Example of my
xml file below. Notice the chartlink: I use the unparsed-text in xsl to get
this html and put then together, xml and html.

<?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>
		</question>
         </goal>
</gqmroot>


Thanks a lot,
LUCAS




> The usual approach to to convert your XML to XSL-FO via XSLT, and then use a
processor to convert it to PDF. The best-known open source processor is FOP,
which you can find on the Apache site.
> --
> Charles Knell
> cknell@xxxxxxxxxx - email
>
>
>
> -----Original Message-----
> From:     Lucas Gongalves Grossi <lggrossi@xxxxxxxxxx>
> Sent:     Tue,  4 Dec 2007 09:17:49 -0300
> To:       "xsl-list" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Subject:  [xsl] Outputing PDF
>
> Hi everybody,
>
> I have this xsl that is outputing an html. I wanna know how can I output a
PDF.
>
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="html" encoding="UTF-8"/>
>
> <xsl:template match="/">
> 	<html><head></head>
> 	<script>
> 	function ativaSubMenus(quem){
> 	    var uls = quem.getElementsByTagName('ul')
> 	    for(var i=0; i<uls.length; i++){
> 	        uls[i].style.display = 'none';
> 	    }
>
> 	    var h3s = quem.getElementsByTagName('h4')
> 	    for(i=0; i<h3s.length; i++){
> 	        h3s[i].style.MozUserSelect = 'none';
> 	        h3s[i].unselectable = 'on';
> 	        h3s[i].style.cursor = 'pointer';
> 	        h3s[i].onclick = function(e){
> 	            var source = getSource(e);
> 	            var ulatual = source.parentNode.getElementsByTagName('ul')[0];
> 	            if(ulatual.style.display=='none'){
> 	                ulatual.style.display = 'block';
> 	            }else{
> 	                ulatual.style.display = 'none';
> 	            }
> 	        }
> 	    }
> 	}
> 	function bodyOnReady(func){
> 	    if(!(document.body==null)){
> 	        func();
> 	    }else{
> 	        var func_rep = func;
> 	        setTimeout(function(){ bodyOnReady(func_rep) },100);
> 	    }
> 	}
>
> 	function getSource(evt){
> 	    if(typeof(evt)=='undefined') var evt=window.event
> 	    source = evt.target?evt.target:evt.srcElement
> 	    if(source.nodeType == 3)source = source.parentNode
> 	    return source;
> 	}
>
>
> 	bodyOnReady(function(){ ativaSubMenus( document.getElementById('menuzao') )
})
> 	</script>
> 	<body>
> 	<ul id='menuzao'>
> 	    <li><h4><xsl:value-of select="gqmroot/@titleRoot"/></h4>
> 	        <ul>
> 	            <xsl:for-each select="gqmroot/goal">
> 					<li><h4><xsl:value-of select="@titleGoal"/></h4></li>
> 					<ul>
> 						<xsl:for-each select="question">
> 							<li><h4><xsl:value-of select="@titleQuestion"/></h4></li>
> 							<ul>
> 								<xsl:for-each select="metric">
> 									<li><xsl:value-of select="@titleMetric"/></li>
> 									<xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/>
> 								</xsl:for-each>
>
> 							</ul>
> 						</xsl:for-each>
>
> 					</ul>
> 				</xsl:for-each>
>
> 	        </ul>
> 	    </li>
> 	</ul>
> 	</body></html>
> </xsl:template>
>
> Thanks,
> LUCAS

Current Thread