xsl-list
[Top] [All Lists]

Re: how to match true and false and display yes and no instead?

2005-07-27 10:27:11
Well, if you actually tried to run these templates, your XML parser should 
spit out error messages.

You seem to be trying to use </xsl:apply-templates> to close 
<xsl:template>, which isn't XML.

Assuming you mean

<xsl:template match="members">
xsl-fo goes here.....
</xsl:template>

then you want

<xsl:template match="members">
xsl-fo goes here.....
<xsl:apply-templates/>
</xsl:template>

Otherwise, the processor gets to members and stops, never processing the 
children of members.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Christian Rasmussen <byggemandbob(_at_)gmail(_dot_)com> 
07/27/2005 11:57 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc

Subject
[xsl] how to match true and false and display yes and no instead?






Hi experts,

It seems to be a pretty simple question, but I'm newbie and I cannot
figure out how to do it :-(
please help me!

here is some sample xml showing my problem:

<members>
                 <profile>
                                 <name>Bill Clinton</name>
                                 <married>false</married>
                                 <kid>joe</kid>
                 </profile>
</members>


my xsl looks something like this:

<xsl:template match="members">
xsl-fo goes here.....
</xsl:apply-templates>

<xsl:template match="members/profile/married">
<xsl:if test=".='false'">no, he is not married</xsl:if>
<xsl:if test=".='true'">yes, he is married</xsl:if>
</xsl:apply-templates>

<xsl:template match="kid">
xsl-fo goes here.....
<xsl:apply-templates select="../married"></xsl:apply-templates>

I simply want to display "yes" and "no" instead of "true" and "false".
So I have made a template match which specifically matches the element
which holds the true or false value. After matching this element, I
test whether its true or false, and returns the text instead.

nothing shows up :-(

Thanx in advance for you help 
/Christian

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--