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

RE: end.tag minimization problem continued

Subject: RE: end.tag minimization problem continued
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Tue, 17 May 2005 13:18:27 +0000
xsl end tag
Mikael,

With this XML:

<dataType>
   <sequence>
       <moRef name="ManagedObject"/>
       <length>5</length>
   </sequence>
</dataType>

And this XSL (on xalan):

<?xml version="1.0" encoding="iso8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>


   <xsl:template match="sequence">
       <!-- Check if <sequence>-element has no <length> attribute.-->
       foo
       <xsl:if test="not(length)">
           <xsl:message terminate="yes">
           <!-- class name and attribute error message -->
            Attribute:<xsl:value-of select="../@name"/>
            Class:    <xsl:value-of select="../../@name"/>
            Error:    sequence missing child element, length.
          </xsl:message>
       </xsl:if>
       bar
   </xsl:template>

</xsl:stylesheet>

I get:

       foo
       bar

which is what was expected. Same with empty-element <length/>. When I remove the <length> element I get a termination message, again as expected.

Regards,

--A


From: "Mikael Petterson (KI/EAB)" <mikael.petterson@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  end.tag minimization problem continued
Date: Tue, 17 May 2005 07:35:07 +0200

Hi,

We are transforming and xml into java code using xsl/xslt in java.
Ny xsl look like this;

......
<!-- Start: Sequence -->
     <xsl:when test="sequence">
     <!-- Check if <sequence>-element has no <length> attribute.-->
     <xsl:if test="not(length)">
      <xsl:message terminate="yes">
        <!-- class name and attribute error message -->
         Attribute:<xsl:value-of select="../@name"/>
	     Class:    <xsl:value-of select="../../@name"/>
         Error:    sequence missing child element, length.
       </xsl:message>
     </xsl:if>
........

When I execute my transformation it fails ( see error below).
The following xml is ok:

<dataType>
                 <sequence>
                     <long>
                        <range>
                            <min>-500</min> <max>500</max>
                        </range>
                     </long>
                     <length>12</length>
                 </sequence>
 </dataType>

But when this xml is tranformed ( below) it fails:

<dataType>
                 <sequence>
                    <moRef name="ManagedObject"/>
                     <length>5</length>
                 </sequence>
</dataType>

I interpret it as when I have a single <element/> I get the error but when I have <element></element> it is a ok.
Do I have to make any settings to the xml transformation?

_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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.