[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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.
Here is what I've been trying, but it isn't working unless values are specified:
<xsl:choose>
<xsl:when test="@minOccurs=0 and @maxOccurs=''"> optional
</xsl:when>
<xsl:when test="@minOccurs=nil and @maxOccurs=nil"> required
</xsl:when>
<xsl:when test="@minOccurs=1 and @maxOccurs=1"> required
</xsl:when>
<xsl:when test="@minOccurs=1 and @maxOccurs='unbounded'"> required repeating
</xsl:when>
<xsl:when test="@minOccurs='' and @maxOccurs='unbounded'"> required repeating
</xsl:when>
<xsl:otherwise> min:<xsl:value-of select="@minOccurs"/> max:<xsl:value-of select="@maxOccurs"/>
</xsl:otherwise>
</xsl:choose>
voice: 502-749-6179
[xsl] testing for a missing attribute
Subject: [xsl] testing for a missing attribute From: Dan Vint <dvint@xxxxxxxxx> Date: Sat, 10 Jul 2010 19:21:47 -0700 |
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.
Here is what I've been trying, but it isn't working unless values are specified:
<xsl:choose>
<xsl:when test="@minOccurs=0 and @maxOccurs=''"> optional
</xsl:when>
<xsl:when test="@minOccurs=nil and @maxOccurs=nil"> required
</xsl:when>
<xsl:when test="@minOccurs=1 and @maxOccurs=1"> required
</xsl:when>
<xsl:when test="@minOccurs=1 and @maxOccurs='unbounded'"> required repeating
</xsl:when>
<xsl:when test="@minOccurs='' and @maxOccurs='unbounded'"> required repeating
</xsl:when>
<xsl:otherwise> min:<xsl:value-of select="@minOccurs"/> max:<xsl:value-of select="@maxOccurs"/>
</xsl:otherwise>
</xsl:choose>
..dan --------------------------------------------------------------------------- Danny Vint
Panoramic Photography http://www.dvint.com
voice: 502-749-6179
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: "mode" not working as exp, Dick Penny | Thread | Re: [xsl] testing for a missing att, G. Ken Holman |
[xsl] Re: "mode" not working as exp, Dick Penny | Date | Re: [xsl] testing for a missing att, G. Ken Holman |
Month |
Keywords