[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XPath which tests that an element does not have mixed content?


Subject: [xsl] XPath which tests that an element does not have mixed content?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Thu, 3 Nov 2011 18:44:59 +0000

Hi Folks,

Would you please recommend an XPath expression which ensures that the content
of <author> is optional whitespace, <Person>, optional whitespace, and nothing
else:

    <author>
        <Person>
            <name>Simon L. Peyton Jones</name>
        </Person>
    </author>

The result of the XPath expression is true if the content is as desired and
false otherwise. The XPath should return true for the above example and false
for the below example:

    <author>
       The person is:
        <Person>
            <name>Simon L. Peyton Jones</name>
        </Person>
    </author>


/Roger


Current Thread
Keywords