Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2008, 10:15 AM
Registered User
 
Join Date: Mar 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default MapForce mapping problem

Hello again,
I have a problem with simple mapping in Altova MapForce,
Here are my files:

***Input XSD:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="csv_data_records">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="record" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="voltage"/>
                            <xs:element name="current"/>
                        </xs:sequence>
                        <xs:attribute name="num" use="required"/>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
***Output XSD:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="baza">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="pomiar" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="voltage">
                                <xs:complexType>
                                    <xs:attribute name="unit" type="xs:string" use="required"/>
                                    <xs:attribute name="value" type="xs:anySimpleType" use="required"/>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="current">
                                <xs:complexType>
                                    <xs:attribute name="unit" type="xs:string" use="required"/>
                                    <xs:attribute name="value" type="xs:anySimpleType" use="required"/>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
***Input XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<csv_data_records xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\DOCUME~1\MasterAdmin\Pulpit\test_in.xsd">
    <record num="1">
        <voltage>mV</voltage>
        <current>A</current>
    </record>
    <record num="2">
        <voltage>1000</voltage>
        <current>1000</current>
    </record>
    <record num="3">
        <voltage>2000</voltage>
        <current>2000</current>
    </record>
    <record num="4">
        <voltage>3</voltage>
        <current>3</current>
    </record>
</csv_data_records>
When attribute "num" is set to 1 (one), under elements of voltage and current there is info about unit (volt and amper or V and A).
When attribute "num" is higher that 1, so when its 2,3, etc, then there is a value of voltage and current.

What I'm looking for in this egzample:
*when unit is "mV" I want value to be divided by 1000,
*when unit is "kV" I want value to be multiplyed by 1000,

Output XML should look like below:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<baza xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/DOCUME~1/MasterAdmin/Pulpit/test_out.xsd">
    <pomiar>
        <voltage unit="V" value="1000"/>
    </pomiar>
    <pomiar>
        <voltage unit="V" value="2000"/>
    </pomiar>
    <pomiar>
        <voltage unit="V" value="3"/>
    </pomiar>
</baza>
In the code above current is omitted, solution will be the same for voltage and current, so only 1 is needed.
I tried to do that for past few hours and no result. The main problem are data types. When it looks like all is ok, then I get lexical value error
Code:
lexical value error- " - xs:double(or decimal)
Below I include link to image of this little project in MapForce.
http://img179.imagevenue.com/img.php...u_122_92lo.jpg

And my little request: It would be best to see the solution in MapForce, because then I would understand how its connected, and how its works.
Best regards :)

 
Old March 19th, 2008, 10:21 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Altova has its own forums, see http://www.altova.com/forum/default.aspx?g=topics&f=38 for a MapForce forum.

 
Old March 19th, 2008, 10:34 AM
Registered User
 
Join Date: Mar 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you're right, stupid of me






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with dateField while Mapping mamatharocks Biztalk 0 September 18th, 2008 11:25 PM
Many-to-Many Relationships in O/R Mapping sarosh Classic ASP Databases 0 December 8th, 2006 05:45 AM
O/R mapping s_sana General .NET 0 April 12th, 2005 06:34 AM
Mapping SID Anantsharma SQL Server 2000 2 February 10th, 2005 05:32 AM
DTS Column Mapping Problem hortoristic SQL Server 2000 2 August 2nd, 2004 03:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.