xsl-list
[Top] [All Lists]

RE: DOM / Javascript ans XSL

2004-04-26 08:48:22
Hi Bertrand,

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

What does that mean, 'block'? What is exactly your output - could you post
it please?

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

Q2: When do you call the function 'search'? Cause this is where the
transformation occurs.

With this information added to what you already have posted we may be able
to help you better.

<prs/>
http://www.pietsieg.com
http://www.pietsieg.com/dotnetnuke
Contributor on www.ASPToday.com
Co-author on "Professional ASP.NET XML with C#", July 2002 by Wrox Press


-----Original Message-----
From: Bertrand Sauviat [mailto:bsauviat(_at_)elanspeech(_dot_)com] 
Sent: Monday, April 26, 2004 4:33 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] DOM / Javascript ans XSL

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

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


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