This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to test on more than one axis
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] How to test on more than one axis
- From: "David O Baldwin" <david dot baldwin at ntlworld dot com>
- Date: Mon, 3 Sep 2001 18:01:13 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
My XML document has a number of 'mandatory' elements, identified as such by
an attribute, for example:
<Person>
<FirstName>David</FirstName>
<LastName Mandatory="True">Baldwin<LastName>
</Person>
I want to be able to tell if the document is valid in the sense that all of
the 'mandatory' elements in the document contain a value.
I have tried various approaches with count() and using a variable, for
example:
<xsl:template match="/">
<xsl:variable name="Invalid" select="//@Mandatory='True' and //.=''" />
...more xsl using value of Invalid...
</xsl:template>
But the code above (obviously?) returns true if the document contains at
least one 'mandatory' element and one 'empty' element regardless of whether
they are the same element or not. What I am after is all the elements that
are BOTH 'mandatory' and 'empty', but I cannot seem to combine the tests to
be performed on the same element.
Is this a syntax issue, or am I trying to do something the wrong way in xsl?
At the end of the day I am just trying to check the xml contains the
required elements, and I have control of the xml schema, so maybe there is a
better way of approaching this. Any ideas?
Thanks
David O Baldwin
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list