contains Function
Returns True if the first argument string contains the second argument string; otherwise returns False.boolean contains(string, string)
Res
If an argument is not of type string, it is first converted to a string and then evaluated.The following function call returns False.contains("mysampletest", "oba")
Returns True if the first argument string contains the second argument string; otherwise returns False.boolean contains(string, string)
Res
If an argument is not of type string, it is first converted to a string and then evaluated.The following function call returns False.contains("mysampletest", "oba")
我看不太明白,请你写得仔细点好吗
<xsl:if test="contains(nodeName, "xxx")">
<xsl:value-of select="."/>
</xsl:if>
Adds parameters into an Extensible Stylesheet Language Transformations (XSLT) style sheet.
var xslt = new ActiveXObject("Msxml2.XSLTemplate");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var xslProc;
xslDoc.async = false;
xslDoc.resolveExternals = false;
xslDoc.load("sample.xsl");
xslt.stylesheet = xslDoc;
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.load("books.xml");
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.addParameter("param1", "Hello");
xslProc.transform();
alert(xslProc.output);
Sample.xsl<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:param name="param1"/>
<xsl:template match="/">
The parameter value was: <xsl:value-of select="$param1"/>
</xsl:template>
</xsl:stylesheet>
你写的var等代码是不是写到页面上呀,不用写入到后台,对吗?
x.Load(Server.MapPath("x1.xml"));
System.Xml.XmlNodeList nodes = x.SelectNodes("//Name");
foreach(System.Xml.XmlNode y in nodes)
{
if(y.InnerText.IndexOf("李") >-1)
Response.Write(y.InnerText);
}x1.xml
========
<?xml version="1.0" encoding="GB2312"?>
<Persons>
<Person id="1">
<Name>李一</Name>
<Sex>男</Sex>
</Person>
<Person id="2">
<Name>李二</Name>
<Sex>女</Sex>
</Person>
<Person id="3">
<Name>李三</Name>
<Sex>男</Sex>
</Person>
<Person id="4">
<Name>陈四</Name>
<Sex>男</Sex>
</Person>
<Person id="5">
<Name>李四</Name>
<Sex>女</Sex>
</Person>
</Persons>