Got a question about technology? Ask it here. Discussion of hardware, software, TiVos, multi-region DVDs, Windows, Macs, LINUX, hand-helds, iPods, anything tech related. Better than any helpdesk!
Easy-peasy.
<xsl:template match="/">
<xsl:for-each select="employees/employee[@g=0]">
<xsl:if test="status/@s">
<option>
<xsl:attribute name="value"><xsl:value-of select="@i"/>
<xsl:value-of select="@n"/> - <xsl:value-of select="status/@s" />
</option>
</xsl:if>
</xsl:for-each>
</xsl:template>
Although if it's more complicated than that, you'll probably end up having to use an
t xsl:choose
instead of an
t xsl:if
.
Thanks - I'll give that a try.
That was the direction I was going in, but I didn't know about the
<xsl:if test=
stuff....
OK, that's not working, so I'll have to explain the (more) confusing stuff.
The thing is, the
xsl:value-of select="status/@s"
would normally match to multiple rows, except that there's a criteria/filter put on the xsl by the javascript that applies the xsl on the xml.
That looks like this:
xslStyle.loadXML(xslEmployeeComboboxDept.XMLDocument.xml);
selectField = xslStyle.selectSingleNode("//xsl:value-of[@select='status/@s']/@select");
selectField.value = "status[@pp=" + varPayPeriod + "]/@s"
strTemp = xmlMaster.transformNode(xslStyle);
xslEmployeeComboboxDept is the stylesheet where I excerpted the above xsl.
I don't fully understand how this works, but it normally limits
xsl:value-of select="status/@s"
to a single match. Sometimes there are no matches, which is what i want to exclude....
That's very weird, tommyrot.
Edit: Basically, what the original programmer is doing is modifying the stylesheet on the fly, so that the stylesheet that is executed will be different than what the code you see.
Very kludgy.
Tommyrot, what I would do is get rid of the lines:
selectField = xslStyle.selectSingleNode("...");
selectField.value = "status[@pp=" + varPayPeriod + "]/@s"
replace it with:
xslStyle.addParameter("varPayPeriod", varPayPeriod);
add a
<xslt:param name="varPayPeriod"/>
to the beginning of your .xsl file, and change the
<xsl:value-of select="status/@s" />
to
<xsl:value-of select="status[@pp=$varPayPeriod]/@s" />
and use
<xsl:if test="status[@pp=$varPayPeriod]/@s" />
You have my permission to go and beat the original programmer with a stick.
(I might not have the syntax correct, you might have to use @pp='$varPayPeriod' with single quotes)
Thanks, Tom.
what the original programmer is doing is modifying the stylesheet on the fly, so that the stylesheet that is executed will be different than what the code you see.
Very kludgy.
Heh. That's probably why I couldn't find anything like it in my "Beginning XML" book. I think that book
does
have the technique of passing a parameter to xsl like you show.
I've got a few other things to do, but I'll try your code out soon.
A city in Oklahoma was threatening the CentOS Linux distribution because the default Apache test page was showing up on their website.
OMG. I've had customers like that. Unbelievable. The distro guy was unbelievably patient and the OK guy was an asshat not to apologize.
Are there any books that folks here think are "must have" tech books that are on either the Que or Sams imprints? I have a short window in which I could obtain such things and would like to know if there's anything I should be gunning for. Monsieur Scola recommended ""Unix System Administrator's Handbook", which isn't on either of those imprints but was still something I could get a discount on. It looks like it will be an interesting read.
I have good access to books on Mac OS X from a theoretical point of view, but books that have good "down in the trenches" advice on networks, Mac OS X, Linux and Windows would be of interest to me.
Windows Is So Slow, but Why?
Check out all these anonymous blog comments from MSFT employees, calling for management to be fired.
How long has it been since XP came out?
It does seem like quite awhile for a signifcant upgrade to Windows to come out. OTOH, it doesn't seem like Microsoft has been suffering greatly because of it.