[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Help! How do I find elements through text contents XSL
Hi all, I've been pulling my hair out over this and I'm sure it has to be simple. I'm converting HTML to XML (why do all the textbooks only go the other way?) and I need to identify, say for instance, tables by the contents in the header row. So, in the inconsistent input file I might have: <table> <tbody> <tr> <th>Keyword ... Or I might equally have: <table> <tr> <td><b><i>Keyword ... Or any combination in between. The question is, how do I consistently identify this table based on the heading text without knowing the exact node path. I think I've tried all combinations of contains(), text(), ancestor:: etc. My original transform which works was limited to two cases and looked like this: <xsl:template match="body/table"> <xsl:choose> <xsl:when test="contains(tr[1]/th[1],'Keyword')"> <properties> <xsl:apply-templates select="tr" mode="prop"/> </properties> </xsl:when> <xsl:when test="contains(tr[1]/td[1],'Keyword')"> <properties> <xsl:apply-templates select="tr" mode="prop"/> </properties> </xsl:when> Do I really need to create all possible combinations of hierarchies in order to pick these tables up? Thanks in advance for any help or advice you can give, Richard
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|