xsl-list
[Top] [All Lists]

Re: [xsl] When *not* to use XLST...

2009-04-23 16:40:51
On 4/23/2009 1:50 PM, Shawn Milochik wrote:

A final note which may help clarify what I'm asking for: The two most
challenging problems I've had so far were how to get the value of an
attribute of a parent node in the XSLT section that processes the
child,

<xsl:value-of select="../@attrname" />

and how to check to see whether any of the child nodes had a
specific value in a named attribute when processing the parent node.

<xsl:if test="*[(_at_)attrname = 'specificValue']">...

Both are trivial to do with a class in a programming language by just
accessing a property or method. To be fair they're trivial in XSLT as
well, but the syntax to do takes a long time to discover by Google
searches.

Ken Holman pointed out that this is not an ideal way to learn any
language. But I would concede that XSLT is more difficult than most to
learn incrementally. This is because it is more radically different from
your garden-variety scripting language. It's a powerful language, but it
relies on some substantial non-obvious foundational concepts. For that
reason, you really do have to put some time into learning the language,
not just googling examples. I think every language has a curve such that
at some point you reach the place where you save more time by learning
the core concepts well than by searching or asking for just-in-this-case
help. For XSLT that point comes earlier. It's just a lot harder to tweak
an XSLT program and get the result that you expect, when you don't know
the fundamentals.

When I learned XSLT, it was with Jeni Tennison's book, Beginning XSLT
(1st ed.) I would now recommend the new edition. After reading
attentively the first several chapters of that, you will have a solid
grasp of the concepts, and you will be embarrassed at how easy the above
problems have become.

As someone else said, reading this list will help you learn the FAQ's as
well.

Lars


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>