Setparameter and node
"erwy" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
( Sorry for my rusted english :-( )
Hi,
I have a problem with a setParameter.
I would use a "node" type , as a selectNodes of IE, but my xslt refuse
tu use this param
(No error if I not try to use it)
An example of xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalogue type="biliothèque">
<domaine type="Roman" >
<genre type="science-fiction" >
<element >
<nom>Les cavernes d'acier</nom>
<auteur>Isaac Asimov</auteur>
<nombre>3</nombre>
</element>
<element >
<nom>Dune</nom>
<auteur>Frank Herbert</auteur>
<nombre>6</nombre>
</element>
</genre>
</domaine>
</catalogue>
My xslt
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
<xsl:param name="selection"/>
<xsl:template match="/">
<table border="2">
<tbody>
<tr>
<th class="hand" onclick="pTrier('nom',objDoc)">Nom</th><th
class="hand" onclick="pTrier('auteur',objDoc)">auteur</th><th
class="hand" onclick="pTrier('nombre',objDoc)">nombre</th>
</tr>
<xsl:apply-templates
select="//*[generate-id(.)=generate-id($selection)]/descendant-or-self::element">
</xsl:apply-templates>
</tbody>
</table>
</xsl:template>
<xsl:template match="element">
<tr>
<td><xsl:value-of select="nom"></xsl:value-of></td>
<td><xsl:value-of select="auteur"></xsl:value-of></td>
<td><xsl:value-of select="nombre"></xsl:value-of></td>
</tr>
<br/>
</xsl:template>
</xsl:stylesheet>
and javascript
xcheminTri="/*[1]"
DIV.innerHTML=
fForm(objXml,document.evaluate(xcheminTri,objXml,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null))
function fForm(objXml,param1)
{
var res
var tmpBox = document.createElement("div");
<!--I try also param1.iterateNext() -->
objFormProc.setParameter(null,"selection",param1)
tmpBox.appendChild(objFormProc.transformToFragment(objXml,document));
res=tmpBox.innerHTML
return res;
}
May be it's impossible to use object with Mozilla ?