General discussion

Locked

Web Development Zone TechMail

By Mark W. Kaelin Editor ·
Transform your XML data into HTML with XSLT:

The Feb. 4, Web Development Zone TechMail discusses transforming XML into HTML. In your application development, have you ever needed to transform XML data into HTML? Will this tip on transforming datainto HTML using XSLT style sheets help you?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

XSLT in article is horrible

by zwets In reply to Web Development Zone Tech ...

I have done quite a bit of XSLT in the past; and certainly enough to see that the XSLT sample in the tip is full of bad practices. To name a few:

- the use of xsl:for-each is generally considered bad practice, use xsl:apply-templates instead. XSLT is a functional language, not a procedural one.

- there is no need at all to use an extension function, the XSLT/XPath count() function will do just fine. Probably it will even do better, because it could be optimized by the XSLT compiler.

-more generally, extension functions are non-portable and should only be used for things you can't do in XSLT. In my experience, you hardly ever need them.

- the use of xsl:element and xsl:attribute to create output elements is only needed in specific (generally hairy) situations, and is certainly superfluous in the case of the article.

I am no expert either, but IMO the XSLT in the article looks like it was written by an absolute beginner in XSLT. The author hasn't wrapped his mind aroundthe (functional) concepts of XSLT yet. Which is a pity, because XSL can be highly elegant and concise when written well.

Collapse -

Bad XSLT

by grantwparks In reply to Web Development Zone Tech ...

I agree with the previous poster's points! I ~have~ found the use of <xsl:element> handy when my input XML & XSL had special namespaces - in those cases, the use of a hardcoded output tag seemed to duplicate the namespace declaration in each of thethose output elements. BUT, I most certainly, wholeheartedly, strenuously agree with the condemnation of using the extension function (unless the use of such was as illustration only) - this XSLT would've been much cleaner without it and using it makes me doubt that the author has much understanding of the richness of node/axes traversal available in XSLT. using <xsl:apply-templates> is also better except in extreme, hack-it-together development.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums