XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Neal  WaltersSubject: For-each not generated automatically
Author: Neal Walters
Date: 10 Mar 2005 09:48 AM
I'm dragging an XML element from a node that occurs multiple times
to another node that occurs multiples times. According to the
doc, "Blocks can be created - automatically when you link one
node to another... If you link repeating elements in the source
and target documents, Stylus Studio automatically creates an
xsl:for-each instruction block in the mapper".
from .pdf file page 418.

Below are relevant schema fragments from my source first then target
second. I used the GUI mapper and mapped IT_QUANTITY to ItemQty and no
for-each block was created. If I manually add the for-each block,
everything works okay. So my question is if I did something wrong
that the for-each block was not added automatically?

Thanks,
Neal Walters
http://Biztalk-Training.com
http://VBScript-Training.com
http://XML-Online-Training.com


<xsd:element name = "ITEMS">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref = "ITEM" maxOccurs = "unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name = "ITEM">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref = "IT_PURCHASE_ID"/>
<xsd:element ref = "IT_SKU"/>
<xsd:element ref = "IT_QUANTITY"/>
<xsd:element ref = "IT_UNIT_PRICE"/>
<xsd:element ref = "IT_SUB_TOTAL"/>
<xsd:element ref = "IT_VID"/>
<xsd:element ref = "SPECIAL_INSTRUCTIONS" minOccurs = "0"/>
<xsd:element ref = "IT_DESCRIPTION"/>
<xsd:element ref = "PAGE_NUMBER" minOccurs = "0"/>
<xsd:element ref = "IT_SOURCECODE" minOccurs = "0"/>
<xsd:element ref = "IT_TAX" minOccurs = "0"/>
<xsd:element ref = "IT_SHIPPING" minOccurs = "0"/>
<xsd:element ref = "IT_TRACK_NO" minOccurs = "0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

Mapping to:

<xs:complexType name="Order">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Site" type="tns:Site" />
<xs:element minOccurs="0" maxOccurs="1" name="BillingAddress-10" type="tns:BillingAddress10" />
<xs:element minOccurs="0" maxOccurs="1" name="EmailInfo-13" type="tns:EmailInfo13" />
<xs:element minOccurs="0" maxOccurs="1" name="ShipMethod-15" type="tns:ShipMethod15" />
<xs:element minOccurs="0" maxOccurs="1" name="User-19" type="tns:User19" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="PaymentMethod-20" type="tns:PaymentMethod20" />
<xs:element minOccurs="0" maxOccurs="1" name="Comments-21" type="tns:Comments21" />
<xs:element minOccurs="0" maxOccurs="1" name="ShippingAddress-30" type="tns:ShippingAddress30" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="Product-40" type="tns:Product40" />
</xs:sequence>

<xs:complexType name="Product40">
<xs:attribute name="ItemQty" type="xs:string" />
<xs:attribute name="ItemEdp" type="xs:string" />
<xs:attribute name="ItemNo" type="xs:string" />
<xs:attribute name="ShipMethod" type="xs:string" />
<xs:attribute name="PhAmt" type="xs:string" />
<xs:attribute name="Price" type="xs:string" />
<xs:attribute name="PriceOveride" type="xs:string" />
<xs:attribute name="AssocNo" type="xs:string" />
<xs:attribute name="Customize1" type="xs:string" />
<xs:attribute name="Customize2" type="xs:string" />
<xs:attribute name="GiftWrapLevel" type="xs:string" />
<xs:attribute name="GiftWrapMessage" type="xs:string" />
<xs:attribute name="GiftWrapCost" type="xs:string" />
<xs:attribute name="GiftWrapTax" type="xs:string" />
</xs:complexType>


Postnext
Minollo I.Subject: Re: For-each not generated automatically
Author: Minollo I.
Date: 10 Mar 2005 09:59 AM
This is a limitation of the current version: repeating elements described
by XML Schema or DTD are not properly recognized; only those described by
an instance document are.

You can, of course, still manually create the "for-each" block and force
the repetition to be taken into account.

Thanks,
Minollo

Postnext
Neal  WaltersSubject: For-each not generated automatically
Author: Neal Walters
Date: 10 Mar 2005 10:11 AM
As I continue reading your manual, I found the following.
The element "ITEM" does not have the icon that identifies it as
a "repeating element", rather it has the normal "element" icon.

But the schema shows it is a repeating item:

<xsd:element name = "ITEMS">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref = "ITEM" maxOccurs = "unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

So if XSLT does not see this as a repeating item, that would explain
why it didn't create the for-each, so now the question is "Why
doesn't Stylus Studio recognize this element as a repeating element?"

Thanks again,
Neal

Postnext
Neal  WaltersSubject: For-each not generated automatically
Author: Neal Walters
Date: 10 Mar 2005 10:14 AM
Sorry, I was posting about the same time you were,
so I didn't read your last message when I posted my last message.
Seems like this is a bug that needs to be fixed.

Neal

Postnext
Minollo I.Subject: Re: For-each not generated automatically
Author: Minollo I.
Date: 10 Mar 2005 10:18 AM
I think I answered this question in my previous post.

BTW, another way to control the kind of link created is to drag&drop the
connection line using the right button of the mouse; a popup menu will let
you choose the kind of link that better describes the operation you are
trying to accomplish.

Thanks,
Minollo

Postnext
Minollo I.Subject: Re: For-each not generated automatically
Author: Minollo I.
Date: 10 Mar 2005 11:58 AM
Reviewing the code involved, the issue is present only when schemas use
"unbounded" for maxOccurrs; a numeric maxOccurs > 1 will work as expected.

A fix will be available soon.

Thanks,
Minollo

Postnext
Neal  WaltersSubject: For-each not generated automatically
Author: Neal Walters
Date: 10 Mar 2005 10:59 AM

From the mapper I add a "xslt:choose" instruction block.
When I right-click it, I have three shortcut menu options:
1) Delete, 2) Go to source, and 3) Add When Port.

Page 439 of the .pdf doc talks about right-clicking it and selecting
the "properties" option. I don't see the properties option.
Am I doing something wrong. (Using build 287h.)


Thanks,
Neal Walters
http://Biztalk-Training.com
http://VBScript-Training.com
http://XML-Online-Training.com

Posttop
Neal  WaltersSubject: For-each not generated automatically
Author: Neal Walters
Date: 10 Mar 2005 11:01 AM
Sorry - last post was meant for a separate thread, I reposted it as new topic. Still trying to use forum properly.

Neal

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.