Re: [TFUI] OT? "if" in XSLT (Re: XML -> XSLT -> XHTML Nirvana)
Cory Foy <Cory.Foy-3E03uoa5e7nqlBn2x/[email protected]> Mon, 14 Mar 2005 09:07:48 -0500
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
J. B. Rainsberger wrote:
> More to the point, why should one need "if" at all? If "if" should
> happen when generating the XML, and the corresponding template is either
> applied or not applied. There is no "if".
Ron's post brings up one scenario I can think of, but I have definitely
encountered other times when xsl:if has come in handy. In my reply to
Phlip, I mentioned that thing that was troubling me wasn't so much that
there was conditional logic in the outputting code, but that the code
was outputting presentation elements instead of pure data.
I would much rather see out of our code:
<title><highlight color="hotpink">The title</highlight></title>
then
<title><span style="background-color:hotpink">The title</span></title>
(outside the whole hotpink thing)
The reason is that we often have to create data structures that are in
turn processed for both web, mobile and pocket PC devices, and rather
than have to modify the outputting code, I would rather modify the
stylesheet.
Actually, thinking about it more, I would rather see
<title highlight="hotpink">The title</title>
That way XSLT sheets can determine if they want to use it or not, but
the other sheets don't ever have to be aware of it. Using the highlight
color as an attribute of the title means that we only have to have the
xsl:if statement on those sheets that actually care about it.
Cory
To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TestFirstUserInterfaces/
<*> To unsubscribe from this group, send an email to:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/