This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: accessing xsl with XML DOM and javascript
- To: xsl-list at lists dot mulberrytech dot com
- Subject: RE: [xsl] accessing xsl with XML DOM and javascript
- From: "Crowers, Steve" <scrowers at liberate dot com>
- Date: Tue, 24 Jul 2001 09:38:50 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm not sure (since I've not tried this before) but try:
node(0).attributes.getNamedItem("name");
Steve Crowers
Software Engineer
Liberate Technologies
2 Walnut Grove,
Suite 200
Horsham, PA 19044
Phone: 215-773-9400 x 9514
Fax: 215-773-9401
scrowers@liberate.com
http://www.liberate.com
-----Original Message-----
From: Elise D. [mailto:tyris_azriel@yahoo.fr]
Sent: Tuesday, July 24, 2001 9:27 AM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] accessing xsl with XML DOM and javascript
hi all,
i do have an xsl where i call a javascript function
inside :
<xsl:for-each select="./*[1]">
<tr bgcolor="6699cc">
<xsl:for-each select="./*">
<td>
><xsl:value-of
select="user:getName(.)"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
and here is the script inside the xsl :
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:user-namespace-here" version="1.0">
<msxsl:script language="javascript"
implements-prefix="user">
<![CDATA[
function getName(node)
{
return node.item(0).nodeName;
}
]]>
</msxsl:script>
here is my xml structure :
<results>
<result>
<field name="Project Site">Paris</field>
<field name="end date">07/04/2001</field>
<field name="Project name">Microsoft Visio 10 VS
Help </field>
<field name="Project Code">ITOSE01001</field>
<field name="Status">Go</field>
</result>
....
</results>
the problem is that my function returns me the name of
the node (field) and in fact i'd like to get the value
of the "name" attribute (example : end date).
i tryed to put return
node.attributes(0).getNamedItem("name");
but it doesn't work.
so someone give me the correct syntax ?
regards,
elise, xml learning girl
___________________________________________________________
Do You Yahoo!? -- Vos albums photos en ligne,
Yahoo! Photos : http://fr.photos.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list