Re: [xslt] Intermittent problem.
- From: rm mh-freiburg de (Le grande pinguin)
- To: xslt gnome org
- Subject: Re: [xslt] Intermittent problem.
- Date: Sat, 24 Aug 2002 18:50:25 +0200
BTW, the stylesheet you posted is pretty "fragile":
<xsl:if test="count(child::text()) = 1">
is a rather dangerous test iff you use it to test whether a
node has children. Even if the node doesn't have a child node,
as soon as it contains an entity (internal or external) the
test will fail. The following document:
|
| <!DOCTYPE doc [
| <!ENTITY test "a sample as well as ">
| ] >
| <doc>This is &test; a test</doc>
|
get's parsed into this tree:
|
| ralf@calvin:/tmp$ xmllint --debug a.xml
| DOCUMENT
| version=1.0
| URL=a.xml
| standalone=true
| DTD(doc)
| ENTITYDECL(test), internal
| content=a sample as well as
| TEXT
| content=a sample as well as
| ELEMENT doc
| TEXT
| content=This is
| ENTITY_REF(test)
| INTERNAL_GENERAL_ENTITY test
| content=a sample as well as
| TEXT
| content= a test
where the doc node has 2(!) text children.
Ralf
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]