|
Subject: Re: [xsl] Again -- non MS transform Sarissa question From: António Mota <xptm@xxxxxxx> Date: Thu, 23 Dec 2004 14:31:05 +0000 |
Also check the output method of your xsl. I had some problems with that,
nothing
that Emmanouil didn't point out correctly in a very short period of time :)
And try to search the sarissa forum, it has a lot of info...
Quoting Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>:
>
> Please direct sarissa related questions to the sarissa forum.
>
> First you need to remove the MS-only script as it causes an error in
> moz. Then you should make sure your stylesheet produces an HTML
> fragment, not a complete HTML document as it now does. Finally, using
> the XSLTProcessor is a good idea:
>
> <script language="JavaScript">
> function transData(){
> // get the source document
> var oDomDoc = Sarissa.getDomDocument();
> oDomDoc.async = false;
> oDomDoc.load("simple.xml");
> alert(oDomDoc.parseError !=
> 0?Sarissa.getParseErrorText(oDomDoc):Sarissa.serialize(oDomDoc));
>
> // get the stylesheet document
> var oXslDoc = Sarissa.getDomDocument();
> oXslDoc.async = false;
> oXslDoc.load("simple.xsl");
> alert(oXslDoc.parseError !=
> 0?Sarissa.getParseErrorText(oXslDoc):Sarissa.serialize(oXslDoc));
>
> // create an instance of XSLTProcessor
> var processor = new XSLTProcessor();
> // make the stylesheet reusable by importing it in the
> // XSLTProcessor
> processor.importStylesheet(oXslDoc);
>
>
> // now apend result to page
>
>
document.getElementById("here").appendChild(document.importNode(processor.tra
nsformToFragment(oDomDoc.,
> document), true));
>
>
> } </script>
>
>
>
> hth,
>
> MAnos
>
> Graber, Jeffrey wrote:
>
> >
> >
> >> -----Original Message-----
> >>From: Graber, Jeffrey
> >>Sent: Wednesday, December 22, 2004 3:19 PM
> >>To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> >>Subject: Again -- non MS transform
> >>
> >>First of all thanks to all who answered. Seems that sarissa should be the
> answer. However, I am only getting the first line displayed instead of the
> whole XML file. I have attached my file. The whole file shows up in the
> alert box but not in the HTML doc.
> >>
> >>
> >>
> > <html>
> > <head>
> > <title>
> > Transform XML Page
> > </title>
> > <script language="JavaScript"
src="js/sarissa.js"></script>
> > </head>
> > <body id="here">
> > <h3 onmouseover="transData()">test IT</h3>
> > <h2 onclick="transData()">try this</h2>
> > <!-- To make it simple, I used the simple files from
> http://www.w3schools.com/xml/xml_examples.asp -->
> > <!-- MS transform works just fine -->
> >
> > <script type="text/javascript">// Load XML
> > var xml = new ActiveXObject("Microsoft.XMLDOM")
> > xml.async = false
> > xml.load("simple.xml")
> >
> > // Load XSL
> > var xsl = new ActiveXObject("Microsoft.XMLDOM")
> > xsl.async = false
> > xsl.load("simple.xsl")
> >
> > // Transform
> > document.write(xml.transformNode(xsl))</script>
> >
> >
> > <script language="JavaScript">
> > function transData(){
> > // get the source document
> > var oDomDoc = Sarissa.getDomDocument();
> > oDomDoc.async = false;
> > oDomDoc.load("simple.xml");
> >
> > // get the stylesheet document
> > var oXslDoc = Sarissa.getDomDocument();
> > oXslDoc.async = false;
> > oXslDoc.load("simple.xsl");
> >
> > // instantiate the result document
> > var oResult = Sarissa.getDomDocument();
> >
> > // transform and store the results to oResult
> > oDomDoc.transformNodeToObject(oXslDoc, oResult);
> >
> > // transform and store the results to a string sResult
> > var sResult = oDomDoc.transformNode(oXslDoc);
> > alert(sResult);
> >
> > // this alert does display the whole file but only the first line is
> transformed by this:
> >
>
>
document.getElementById("here").appendChild(document.importNode(oResult.docum
entElement,
> true));
> > } </script>
> > </body>
> > </html>
> >
> >
> >
> >
> >>Please if you could take the time and explain why I am only getting one
> line instead of the whole doc and what I can do about it.
> >>
> >>Thanks
> >>
> >>Jeff
> >>
> >>Jeff Graber
> >>NG/IT/TASC
> >>703 312 2289
>
>
O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Again -- non MS transform, Emmanouil Batsis | Thread | Re: Re: [xsl] How to do an 'existen, ben |
| Re: Re: [xsl] How to do an 'existen, Mukul Gandhi | Date | [xsl] Namespace issue when using Xa, Andrew Male |
| Month |