Artículo
Fecha: 2010-05-26 10:03:04
Testing for Empty elements in XSL
Different possible meanings for empty: Contains no child nodes: not(node()) Contains no text content: not(string(.)) Contains no text other than whitespace: not(normalize-space(.)) Contains nothing except comments: not(node()[not(self::comment())]) To test if the element exists: <xsl:template match="book"> <xsl:if test="author"> To test if the element exists and is non-empty: <xsl:template match="book"> <xsl:if test="string(author)"> To test that the element exists and has text and/or element content: <xsl:if test="author/* or author/text()"> and even more easily but not quite equivalent as it also tests for comments and processing instructions: <xsl:when test="node()"> |
Autor: Jose Miguel Bataller
Buscador
Últimas entradas
Preseleccionar un option de un element select html con jQuery »
Testing for Empty elements in XSL »
Java Keytool Commands for Managing security certificates »
Execute servlet filter before calling Axis web service »
Set trustStore for SSL connection in Java »
Example of a client-wsdd.config »
Convert Axis Java Object to XML »