我需要做一个叉(取决于启动Javascript与否):是否启用JavaScript?
<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="windows-1251"/>
<xsl:template match="someNode">
<xsl:variable name="vNoscript">
<noscript>true</noscript>
</xsl:variable>
<xsl:choose>
<!-- javascript disabled -->
<xsl:when test="$vNoscript = 'true'">
code branch 1
</xsl:when>
<!-- javascript enabled -->
<xsl:otherwise>
code branch 2
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
此代码不能正常工作 - 在任何情况下,变量“vNoscript”包含值“真”。
有什么方法可以解决这个问题?
可能需要做非常不同的测试吗?
更新1:我在服务器上运行此代码。
更新2:我需要动态加载页面上的图片(使用javascript)。对于那些在浏览器中禁用Javascript的人,我需要以“常用方式”上传图片。
你在哪里运行这个XSLT?在浏览器中?在服务器上?你究竟想实现什么? – 2010-11-09 11:46:42