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
Ronald WilsonSubject: map repeating elements separately to individual elements
Author: Ronald Wilson
Date: 07 Jan 2009 01:25 AM
Maaping Question

source Document:
<Paragraph>
<DateTimeField10>1030</DateTimeField10>
<DateTimeField10>1243</DateTimeField10> [this is Start_Time]
<DateTimeField10>1322</DateTimeField10> [this is next_Time]
</Paragraph>
<Paragraph>
<TextField/>
<DateTimeField10>1315</DateTimeField10>
<DateTimeField10/>
</Paragraph>
<Paragraph>
<DateTimeField10>1448</DateTimeField10> [this is finish_Time}
<DateTimeField10>1502</DateTimeField10>
<DateTimeField10/>
<DateTimeField10>1545</DateTimeField10>
</Paragraph>

Target document:

<xs:element ref="Start_Time"/>
<xs:element ref="next_Time"/>
<xs:element ref="finish_Time"/>


I just do not understand the reate value link; create repeatable vaule link and how to use the FLOWR(?).

This is not well documented in the help.





Postnext
(Deleted User) Subject: map repeating elements separately to individual elements
Author: (Deleted User)
Date: 08 Jan 2009 09:42 AM
Hi Ronald,
in Mapper a value link will create an xsl:value-of instruction, filling the target schema element with the content of the source element; if the source element is a repeatable element, i.e. it can occur multiple times, the XSLT instruction will cause the newly created element to contain the concatenation of the input values.
A repeatable link will instead create a xsl:for-each statement that will generate an empty target element for each element found in the source document.
A repeatable value link will perform both operations, creating a for-each with a value-of inside, so that for each source element a new target element will be created with the same content of the current source element. This is just a shortcut, as the same effect can be achieved by first creating a repeatable link, and then creating a value link between the same two elements.

In you case, you should create multiple value links from DataTimeField10 to each of Start_Time, next_Time and finish_Time. Then, go to the text editor below the Mapper canvas, and add the proper filter predicate to restrict the source XPath to locate the exact time you need to extract. Your XML fragment doesn't have any hint about which criteria should be used to distinguish the various times, so you could be forced to just add a positional predicate like [2] or [3].

<Start_Time>
<xsl:value-of select="(root/Paragraph/DateTimeField10)[2]"/>
</Start_Time>
<next_Time>
<xsl:value-of select="(root/Paragraph/DateTimeField10)[3]"/>
</next_Time>
<finish_Time>
<xsl:value-of select="(root/Paragraph/DateTimeField10)[6]"/>
</finish_Time>

Hope this helps,
Alberto

Posttop
Ronald WilsonSubject: map repeating elements separately to individual elements
Author: Ronald Wilson
Date: 08 Jan 2009 11:58 PM
May the blessings of many children befall you.

Thank you very much.

 
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.