[Home] [By Thread] [By Date] [Recent Entries]
On Sat, 2022-02-12 at 00:31 +0000, Roger L Costello wrote: > Thank you Michael, Ken, and Liam for your fantastic explanations! > > I have one more question, please. > > Is it this: abc&def (i.e., the entity is resolved)? Yes, although it's optional with some parsers. > > Why isn't this the text: abc&def (i.e., the entity is resolved)? It is, although printing out the value will put & back; try string- length() on it. $ xmllint --xpath '/Test[text() = "abc&def"]' /tmp/test.xml <Test>abc&def</Test> $ xmllint --xpath 'string-length(/Test)' /tmp/test.xml 7 % Note that if you put a reference to an external parsed entity in there, you'll get a different result, with the contents of the external document fragment being included in place. In some implementations (e.g. DOM-based) an ENTITY node may be retained for an entity reference; the XDM doesn't have an ENTITY node type, however, so likely it won't be visible to XPath, but a JavaScript program could see it. Liam -- Liam Quin, https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



