[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem with simple xsl:when test expression

Subject: Re: Problem with simple xsl:when test expression
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Tue, 3 Jul 2001 17:33:29 -0400
xsl restriction clause help
First, I hope that this is only a typing error:
    </annotation>


This is illegal.  You probably mean "<annotation/>".  But that would kill
you right there (but you'd get an error message)

Second, it looks like a namespace issue.  You have

<xsl:template match="xsd:simpleType">

but your XML sample doesn't use the "xsd" prefix.  So either it's declared
earlier or it's not declared at all.  If it's not declared, the
xsd:simpleType won't match because of the prefix, and if it is, the other
matches won't work because they would need to be prefixed too.

Cheers,

Tom P

[Phil Mitchell]

> I am trying to write a test expression for a when clause that will be true
> when the context node has a child 'restriction' element whose 'base'
> attribute is "string" -- i.e. <restriction base="string">. I think this
> clause should simply be:
>
>          <xsl:choose>
>   <xsl:when test="./restriction[@base='string']">
>   </xsl:when>
>          </xsl:choose>
>
> But it doesn't seem to work -- it doesn't match. What is wrong with this?
> Here is the context node:
>
> <simpleType name="MedlarsNameString">
>    </annotation>
>    <restriction base="string">
>    </restriction>
> </simpleType>
>
> And here is the stylesheet fragment (slightly edited -- yes, the second
> choose block is meant to be nested in an otherwise block.):
>
> <xsl:template match="xsd:simpleType">
>    <xsl:param name="elementName"/>
>     <xsl:choose>
>        <xsl:when test="@name='TextBlock'">
>         Do this....
>        </xsl:when>
>        <xsl:otherwise>
>          <xsl:choose>
>   <xsl:when test="./restriction[@base='string']">
>   Print here.
>             </xsl:when>
>          </xsl:choose>
>        </xsl:otherwise>
>      </xsl:choose>
> </xsl:template>
>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.