xsl-list
[Top] [All Lists]

DOM / Javascript ans XSL

2004-04-26 02:33:15
Hi
I have a HTML page which call a Javascript.
Here is the Javascript :

var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
 var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
    
xslDoc.async = false;
xslDoc.load("test.xsl");  
    
xmlDoc.validateOnParse = false;
xmlDoc.load("SampleFicheProduit.xml");


    var xslt = new ActiveXObject("Msxml2.XSLTemplate");

                
    xslt.stylesheet = xslDoc;
     var xslProc = xslt.createProcessor();
   xslProc.input = xmlDoc;
  


   function search() {


     xslProc.addParameter("pourqui", form1.code.value);
     xslProc.transform();
 
document.body.innerHTML = xslProc.output;
}


The problem is that the javascript returns the data in block.

In my XSL, I have a template of selection and  I call this template like
this :

<xsl:param name="pourqui"/>

<xsl:template match="document/document-body">
        <xsl:variable name="nombre">
                <xsl:value-of 
select="count(//section[(_at_)pourqui=$pourqui])"/>
        </xsl:variable>
        
        <xsl:choose>
                <xsl:when test="$nombre>=1">
                        <xsl:apply-templates
select="//section[(_at_)pourqui=$pourqui]"/>
                </xsl:when>
                
                <xsl:otherwise>
                        <div><h1>no response</h1></div>
                </xsl:otherwise>
                
        </xsl:choose>
        <b><xsl:value-of select="//essai"/></b>
                
</xsl:template>



<xsl:template match="/">
<html>

<body>
<table border="2">
<tr><td>
        <xsl:apply-templates select="document/document-body"/>
        
</td>
</tr>
</table>
</body>
</html>
</template>


My XML :

<document>
<document-body>
<section pourqui="1">
        <paquet1>I am the paquet 1</paquet1>
</section>

<section pourqui="2">
        <paquet2>I am the paquet 2.1</paquet2>
        <paquet2>I am the paquet 2.2</paquet2>
        <paquet2>I am the paquet 2.3</paquet2>
</section>
</document-body>
</document>


How can I return the paquet 1 in bold for example and the paquet 2
formatting in a list?

The .inner.HTML returns always a block and in the XSL, I can't adjust both
the return of the Javascript and both the formatting of the node which are
returned

Help is welcome
Thanks


<Prev in Thread] Current Thread [Next in Thread>