IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: hardywang
About
User Name: hardywang
Forum Rank: Newbie
Real Name:
Location
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Monday, May 12, 2008
Last Visit: Thursday, February 18, 2010 7:03:00 PM
Number of Posts: 8
[0.04% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: XSLT Imcompatibility?
Posted: Thursday, February 18, 2010 7:03:00 PM
that wrote:
You can change the source schema to use a string instead of an integer. Then MapForce will not try to cast it to numeric on reading.


Thanks, I cannot change any of the schema file.

Anyway, I found a way that in MapForce I add function to convert integer to string first, so the generated XSLT will be

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was generated by Altova MapForce 2008r2

YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.

Refer to the Altova MapForce Documentation for further details.
https://www.altova.com/mapforce
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xsi xsl">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/Root1">
        <Root2>
            <xsl:for-each select="Phone">
                <Phone>
                    <xsl:value-of select="string(.)"/>
                </Phone>
            </xsl:for-each>
        </Root2>
    </xsl:template>
</xsl:stylesheet>
Topic: XSLT Imcompatibility?
Posted: Thursday, February 18, 2010 5:21:23 PM
Hi all, I generated XSLT from Altova MapForce and it seems that different Xml engine will treat it in a slightly different way.

I use followiing sample to describe the problem we currently have:

Source 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="Root1">
        <xs:annotation>
            <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Phone" type="xs:integer"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


Destination 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="Root2">
        <xs:annotation>
            <xs:documentation>Comment describing your root element</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Phone" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


Thare is only 1 element in each, the difference is that source phone number is integer data type, and destination phone number is string data type.

The XSLT generated from MapForce
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was generated by Altova MapForce 2008r2

YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.

Refer to the Altova MapForce Documentation for further details.
https://www.altova.com/mapforce
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xsi xsl">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/Root1">
        <Root2>
            <xsl:for-each select="Phone">
                <xsl:variable name="Vvar11_Phone_integer" select="number(.)"/>
                <Phone>
                    <xsl:value-of select="string($Vvar11_Phone_integer)"/>
                </Phone>
            </xsl:for-each>
        </Root2>
    </xsl:template>
</xsl:stylesheet>


The input Xml is
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 rel. 2 (https://www.altova.com)-->
<Root1 xsi:noNamespaceSchemaLocation="test1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Phone>2817956177</Phone>
</Root1>


I used Altova XmlSpy 2008, Altova MapForce 2008, .Net Framework 3.5 code to transform the Xml above and I could get expected result
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Root2>
    <Phone>2817956177</Phone>
</Root2>


But meanwhile, some Java framework, XML Copy Editor from http://xml-copy-editor.sourceforge.net/ will generate result
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Root2>
  <Phone>2.817956177e+009</Phone>
</Root2>


The problem is the XSLT function <xsl:variable name="Vvar11_Phone_integer" select="number(.)"/>, if it is changed to <xsl:variable name="Vvar11_Phone_integer" select="string(.)"/> then both sides work.

Is there a way I can force MapForce to generate the function to take care the Imcompatibility issue?

Thanks
Hardy
Topic: How to Insert current date?
Posted: Wednesday, February 3, 2010 2:55:14 PM
I would like to insert current date somewhere in my HTML, how can I do it in StyleVision 2008?

Thanks
Hardy
Topic: How to filter content to display?
Posted: Monday, November 30, 2009 12:47:43 PM
vlad wrote:
Simply right-click the Name template, select "Edit XPath Filter" and enter your XPath statement

@Part="first"


Hi,

Thanks for your response, I am running 2008 version of StyleVision, I don't see such a menu item from right-click.

Do I have to upgrade to 2010 version?

Thanks
Hardy
Topic: How to filter content to display?
Posted: Friday, November 27, 2009 3:58:16 PM
Hi all,

I have a Xml like:

<Customer>
<Name Part="first">John</Name>
<Name Part="last">Smith</Name>
</Customer>

Now I create a content inside HTML "[Name>(content)<Name]" which points to Customer/Name. In the output HTML I always can see "John Smith".

How about I just want first name as output, what do I do to filter only Customer/Name[@Part="first"] inside a content?

Thanks
Hardy
Topic: XmlSpy does not like this code snip
Posted: Thursday, July 23, 2009 12:16:54 PM
I downloaded a XSD with following lines inside, XmlSpy complains about the red part saying "value is not a valid XML regular expression".

I tried that expression in C# it works fine. Anybody can tell me why?

<xs:simpleType name="ComponentGuid">
<xs:annotation>
<xs:documentation>Values of this type will look like: "01234567-89AB-CDEF-0123-456789ABCDEF" or "{01234567-89AB-CDEF-0123-456789ABCDEF}", but also allows "PUT-GUID-HERE" for use in examples. It's also possible to have an empty value "".</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[{(]?[0-9A-Fa-f]{8}\-?[0-9A-Fa-f]{4}\-?[0-9A-Fa-f]{4}\-?[0-9A-Fa-f]{4}\-?[0-9A-Fa-f]{12}[})]?|PUT\-GUID\-(?:\d+\-)?HERE|([!$])(\(var|\(loc|\(wix)\.[_A-Za-z][0-9A-Za-z_.]*\)|\*|^$"/>
</xs:restriction>
</xs:simpleType>
Topic: How to delete imported functions?
Posted: Friday, May 16, 2008 12:29:25 PM
szopen wrote:
When you double-click on function to edit it, there are two buttons, one on the left on the image, which returns you to main mapping,
and there's second button, far on the right side, it's name is "Erase", and this one deletes your function.
Here's image:


Hope this hepls
Best regards :)


Unfortunately for the imported functions there is no such a button. For the functions created inside this mapping I can delete without problem.

Hardy
Topic: How to delete imported functions?
Posted: Monday, May 12, 2008 7:36:33 PM
Hi all,

I created a new mapping project and imported some functions from other mfd file. Now the imported ones just sit in my libraries, I neither could edit them nor delete them.

What can I do to remove them?

Hardy

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.