P
Philo
How do I select all <div> tags except those which contain a <table> tag
somewhere within them?
Example XML:
<********************** sample input ***********************>
<txtSectionBody>
<div>
<span>
Text Content
</span>
</div>
<div>
<span>
<table>
<tbody vAlign="top">
<tr>
<td>
<div>
<font style="FONT-SIZE: 11pt" size="+
0">
<strong>Dose (mg)</strong>
</font>
</div>
</td>
</tr>
<tr>
<td>
<div>
<font style="FONT-SIZE: 11pt">
250
</font>
</div>
</td>
</tr>
</tbody>
</table>
</span>
</div>
<div>
<font face="undefined">
<span style="FONT-SIZE: 11pt">Various text content</span>
</font>
</div>
<div>
<font face="undefined">
<span style="FONT-SIZE: 11pt">More text content</span>
</font>
</div>
</txtSectionBody>
</********************** sample input ***********************>
Which I need to transform to
<text>
<paragraph>
Text content
</paragraph>
<table>
<tr>
<td>Dose (mg)</td>
</tr>
<tr>
<td>250</td>
</tr>
</table>
<paragraph>
Various text content
</paragraph>
<paragraph>
More text content
</paragraph>
</text>
So I need to select out the div's that *don't* wrap a table and transform
them to paragraph tags, then grab the table out of the div tag and put it
as a child of the document.
I'm trying this:
<text>
<xsl:for-each select="txtSectionBody">
<xsl:for-each select="xhtml:div[not(self::table)]">
<paragraph>
<xsl:value-of select="."/>
</paragraph>
</xsl:for-each>
<xsl:for-each select="xhtml:div/span/table">
<table>
<xsl:for-each select="tbody/tr">
<tr>
<xsl:for-each select="td">
<td>
<xsl:value-of select="."/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:for-each>
</text>
Help?
Philo
(email is first name, middle initial "j", last name. Remove the last name
to reply)
somewhere within them?
Example XML:
<********************** sample input ***********************>
<txtSectionBody>
<div>
<span>
Text Content
</span>
</div>
<div>
<span>
<table>
<tbody vAlign="top">
<tr>
<td>
<div>
<font style="FONT-SIZE: 11pt" size="+
0">
<strong>Dose (mg)</strong>
</font>
</div>
</td>
</tr>
<tr>
<td>
<div>
<font style="FONT-SIZE: 11pt">
250
</font>
</div>
</td>
</tr>
</tbody>
</table>
</span>
</div>
<div>
<font face="undefined">
<span style="FONT-SIZE: 11pt">Various text content</span>
</font>
</div>
<div>
<font face="undefined">
<span style="FONT-SIZE: 11pt">More text content</span>
</font>
</div>
</txtSectionBody>
</********************** sample input ***********************>
Which I need to transform to
<text>
<paragraph>
Text content
</paragraph>
<table>
<tr>
<td>Dose (mg)</td>
</tr>
<tr>
<td>250</td>
</tr>
</table>
<paragraph>
Various text content
</paragraph>
<paragraph>
More text content
</paragraph>
</text>
So I need to select out the div's that *don't* wrap a table and transform
them to paragraph tags, then grab the table out of the div tag and put it
as a child of the document.
I'm trying this:
<text>
<xsl:for-each select="txtSectionBody">
<xsl:for-each select="xhtml:div[not(self::table)]">
<paragraph>
<xsl:value-of select="."/>
</paragraph>
</xsl:for-each>
<xsl:for-each select="xhtml:div/span/table">
<table>
<xsl:for-each select="tbody/tr">
<tr>
<xsl:for-each select="td">
<td>
<xsl:value-of select="."/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:for-each>
</text>
Help?
Philo
(email is first name, middle initial "j", last name. Remove the last name
to reply)