Thread: Help with style
View Single Post
 
Old November 2nd, 2006, 08:57 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Firstly, the two branches of your "or" are the same:

w:tbl[(w:tr/w:tc='Table Header') or (w:tr/w:tc='Table Header')]">


More importantly, you need to decide what to do with the w:tbl elements that don't match this predicate. At the moment your match="*" rule will kick in, so you'll hit the w:tr elements and output rows without a table to contain them. The equivalent to your for-each is to skip such tables entirely. Use an empty template rule:

<xsl:template match="w:tbl"/>

This has lower priority than the rule with a predicate, so it provides a fallback. (Provided you don't write it as match="//w:tbl"!)

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference