Subject: RE: <xsl:copy-of> question
From: "Hunter, David" <dhunter@xxxxxxxxxxxx>
Date: Fri, 17 Dec 1999 09:31:17 -0500
|
From: Kay Michael [mailto:Michael.Kay@xxxxxxx]
Sent: Friday, December 17, 1999 6:27 AM
>
> Perhaps
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template match="/">
> <xsl:choose>
> <xsl:when test="boolean(/employee/@FullSecurity)">
> <xsl:copy-of select="/"/>
> </xsl:when>
> <xsl:otherwise>
> <employee>
> <xsl:for-each select="employee/*[not(self::salary)]">
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </employee>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> </xsl:stylesheet>
>
> Mike Kay
Aha! It works! And one short hour after I sent the email throwing in the
towel on <xsl:copy-of>. ;-) (I had to change
boolean(/employee/@FullSecurity) to number(/employee/@FullSecurity), though.
boolean() seems to just check whether there *is* a FullSecurity attribute,
but if I change it to a number, then the test attribute is changed to a
Boolean for me, and it works properly. I assume I could be even more
explicit, and say boolean(number(blah))...)
Now all I have to do is figure out my whitespace issues when FullSecurity is
false. (Everything is indented beautifully when the whole document is
copied, but when it's copying them node-by-node, there are no newlines in
there.)
Thanks Mike.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|