functx:has-simple-content

Se um elemento tem conteúdo simples

Descrição

A função functx:has-simple-content devolve true se o elemento não tiver elementos filhos, mas tiver algum texto, mesmo que seja só espaço em branco.

Parâmetros

Descrição

element:element()

o elemento XML a testar

Exemplos

Os exemplos abaixo usam este documento de entrada:

<xsl:variable name="in-xml" as="item()*">
  <in-xml>
     <a></a>
     <b/>
     <c>   </c>
     <d>xml</d>
     <e><x>xml</x></e>
     <f>mixed <x>xml</x></f>
  </in-xml>
</xsl:variable>

XPath

Resultado

functx:has-simple-content($in-xml/a)

false

functx:has-simple-content($in-xml/b)

false

functx:has-simple-content($in-xml/c)

true

functx:has-simple-content($in-xml/d)

true

functx:has-simple-content($in-xml/e)

false

functx:has-simple-content($in-xml/f)

false

Veja também