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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.