|
以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 XSL/XSLT/XSL-FO/CSS 』 (http://bbs.xml.org.cn/list.asp?boardid=8) ---- 如何删除空值节点 (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=20871) |
|
-- 作者:jiangdami -- 发布时间:8/3/2005 2:16:00 PM -- 如何删除空值节点 在xml文档中有这种情况: <A> <B>123</B> <C>456</C> <D/> </A> <A> <B>123</B> <C/> <D>789</D> </A> 有些元素可能没有值,现在我想转换一下,把没有值的元素删除,请问xslt如何写? |
|
-- 作者:孤独 -- 发布时间:8/3/2005 7:07:00 PM -- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method = "xml" omit-xml-declaration = "yes" indent = "yes"/> <xsl:template match="/ | @* | node()"> <xsl:if test='text() !=''"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:if> </xsl:template> </xsl:stylesheet> 这样可能会把属性也解决掉,^_^... |
|
-- 作者:bjshengyu333 -- 发布时间:8/11/2005 2:31:00 PM -- 不错,有启发 |
|
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
35.156ms |