Endbringer
Technical User
I've got a stylesheet that it isn't quite working right. here it is.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslaram name="projectName">Default value</xslaram>
<xslutput method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<html xmlns="
<head>
<title>Engineering Archive</title>
</head>
<body>
<table border="1">
<tr><td width="400" height="*">
You searched for: <b><xsl:value-of select="$projectName"/></b>
</td></tr>
<tr><td width="400" height="*">
<xsl:apply-templates />
</td></tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="name">
<xsl:for-each select="//name">
<xsl:variable name="projName">
<xsl:value-of select="." />
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($projName,$projectName)">
<xsl:value-of select="." />
</xsl:when>
<xsltherwise>
There were no matches.
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
If $projectName is contained under //name, i want it to return just those nodes.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslaram name="projectName">Default value</xslaram>
<xslutput method="html" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<html xmlns="
<head>
<title>Engineering Archive</title>
</head>
<body>
<table border="1">
<tr><td width="400" height="*">
You searched for: <b><xsl:value-of select="$projectName"/></b>
</td></tr>
<tr><td width="400" height="*">
<xsl:apply-templates />
</td></tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="name">
<xsl:for-each select="//name">
<xsl:variable name="projName">
<xsl:value-of select="." />
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($projName,$projectName)">
<xsl:value-of select="." />
</xsl:when>
<xsltherwise>
There were no matches.
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
If $projectName is contained under //name, i want it to return just those nodes.