This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re:pass value between xml and javascript
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Re:pass value between xml and javascript
- From: "Yang" <sfyang at unisvr dot net dot tw>
- Date: Mon, 10 Sep 2001 12:04:12 +0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
Chen;
Gethering the suggestions from Max Dunn, Jeni, Ciao and your posts , I
put
a tested xslt with msxml3 for your reference.
Also I simplify your attribute element using AVT(attribute value template)
which a highly
recommended exercise in this list.
Cheers,
Sun-fu Yang
sfyang@unisvr.net.tw
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<head>
<script language="javascript">
function WM_toggle(id){
if (document.all){
if(document.all[id].style.display == 'none'){
document.all[id].style.display = 'block';
} else {
document.all[id].style.display = 'none';
}
} else if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
}
}
</script>
</head>
<body>
<p>
<!--menu part-->
<xsl:for-each select="placetogo/urbanspace">
<a href="#" onclick="WM_toggle('{cityid}'); return false"><xsl:value-of
select="placename"/></a> <br />
</xsl:for-each>
</p>
...
<!--content part-->
<xsl:for-each select="placetogo/urbanspace">
<p align="center" class="main" style="display: none" id="{cityid}">
<xsl:value-of select="placename"/> <br />
<img src="{photo/@img}"/><br />
<xsl:value-of select="country"/>
<xsl:value-of select="description"/>
<xsl:value-of select="continent"/>
</p>
</xsl:for-each>
</body>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list