您好我正在尝试根据以下输入的样本返回一个表:
<Table TableLevel="1" TableNumber="1" TableTitle="">
<TableRow TableRowLevel="1" RowTitle="" TableRowNumber="1" class="Even">
<TableHeader width="33" class="tableheadercell">
<Paragraph>Account Name</Paragraph>
</TableHeader>
<TableHeader width="10" class="tableheadercell">
<Paragraph>Type</Paragraph>
</TableHeader>
<TableHeader width="57" class="tableheadercell">
<Paragraph>Additional Information</Paragraph>
</TableHeader>
</TableRow>
<TableRow TableRowLevel="1" RowTitle="" TableRowNumber="2" class="OddLegacy">
<TableCell>
<Paragraph>ANONYMOUS LOGON</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Group</Paragraph>
</TableCell>
<TableCell>
<UnorderedList UnorderedListLevel="1" class="compactList" UnorderedListNumber="1">
<ListItem>comment: ANONYMOUS LOGON</ListItem>
<ListItem>group-id: 7</ListItem>
</UnorderedList>
</TableCell>
</TableRow>
<TableRow TableRowLevel="1" RowTitle="" TableRowNumber="3" class="Even">
<TableCell>
<Paragraph>Administrators</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Group</Paragraph>
</TableCell>
<TableCell>
<UnorderedList UnorderedListLevel="1" class="compactList" UnorderedListNumber="1">
<ListItem>group-id: 544</ListItem>
</UnorderedList>
</TableCell>
</TableRow>
</Table>
然后是我的 XSLT:
<xsl:variable name="whiteuserxml">
<item>ANONYMOUS LOGON</item>
</xsl:variable>
<xsl:for-each select="Table">
<table>
<xsl:for-each select="TableRow[not(TableCell/Paragraph = $whiteuserxml/item)]">
<xsl:choose>
<xsl:when test="count(TableCell) = 0"/>
<xsl:otherwise>
<tr>
<xsl:for-each select="TableHeader">
<td><b><xsl:apply-templates select="*"/></b></td>
</xsl:for-each>
<xsl:for-each select="TableCell">
<td><xsl:apply-templates select="*"/></td>
</xsl:for-each>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:for-each>
期望的输出:
<table>
<tr>
<td>Administrators</td><td>Group</td><td>the other stufflist</td>
</tr>
</table>
我遇到的问题是,如果表为空,我无法阻止创建表,当我确定它是否包含合法行时,为时已晚,无法重新添加表名