|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: testing for a missing attribute
At 2010-07-10 19:21 -0700, Dan Vint wrote:
I'm trying to process an XML schema and produce some documentation. I'm trying to trap the various ways min/max occurs can be specified and give the typical option/required/repeating translation. min/maxOccurs are not required values and they default to 1 when not specified. I'm having troubles detecting this situation. The above won't work because you are testing that the attribute exists and is the empty string. When the attribute doesn't exist, the operand is the empty set. All tests with the empty set as an operand evaluate to false. </xsl:when> How about having: <xsl:variable name="minOccurs" select="(@minOccurs,1)[1]"/> <xsl:variable name="maxOccurs" select="(@maxOccurs,1)[1]"/> ... and then changing your tests to variables instead of attributes? You won't need the tests for absence since the variable assignment has accommodated absence. I hope this helps. . . . . . . . . . . . Ken -- XSLT/XQuery training: after http://XMLPrague.cz 2011-03-28/04-01 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








