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: Sfire83
About
User Name: Sfire83
Forum Rank: Newbie
Real Name:
Location
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Thursday, April 19, 2018
Last Visit: Thursday, April 19, 2018 10:46:01 AM
Number of Posts: 1
[0.01% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Problem with XSLT result
Posted: Thursday, April 19, 2018 10:29:27 AM
Hello all,


I have a problem and I hope someone can help me.
I think this is only a setting parameter.

I want to map one XML content in an other XML structure.
I know which XSLT result I want to have, but it is not possible for me to create this with Altova Map Force.

I have the main probelm to create different templates, change xsl:stylesheet to xsl:transform

and to include a default template like:

Code:

xsl:template match="@* | node()">
-<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>




Here is a sample that i want to have from Altova MapForce:


Code:
<?xml version="1.0"?>

-<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:template match="ProductionOperators">
     -<ProductionOperators>
     -<xsl:for-each select="Operator">
     -<Operator>
     -<UserID>
     <xsl:value-of select="UserID"/>
     </UserID>
     -<BadgeID>
     <xsl:value-of select="BadgeID"/>
     </BadgeID>
     -<CurrentRoleID>
     <xsl:value-of select="RoleID"/>
     </CurrentRoleID>
     </Operator>
     </xsl:for-each>
     </ProductionOperators>
</xsl:template>
-<xsl:template match="Equipments">
     -<Equipments>
     -<xsl:for-each select="Equipment">
     -<Equipment>
     -<Position>
     -<Name>
     <xsl:value-of select="."/>
     </Name>
     </Position>
     </Equipment>
     </xsl:for-each>
     </Equipments>
</xsl:template>
     

-<xsl:template match="@* | node()">
     -<xsl:copy>
     <xsl:apply-templates select="@* | node()"/>
     </xsl:copy>
     </xsl:template>
</xsl:transform>



and this is my result from Altova MapForce:

Code:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <xsl:variable name="var1_initial" select="."/>
        <dilMessage>
            <xsl:attribute name="xsi:noNamespaceSchemaLocation" namespace="http://www.w3.org/2001/XMLSchema-instance">file:///D:/SVN/dil_and_app_framework-20170918-1710/dil-messages/dilUnitInfo/Version2.0.0Beispiel.xsd</xsl:attribute>
            <Body>
                <ObjectInfo>
                    <UnitInfo>
                        <ProductionInfo>
                            <ProductionOperators>
                                <xsl:for-each select="dilMessage/Body/ObjectInfo/UnitInfo/ProductionInfo/ProductionOperators/Operator">
                                    <xsl:variable name="var2_cur" select="."/>
                                    <Operator>
                                        <UserID>
                                            <xsl:value-of select="UserID"/>
                                        </UserID>
                                        <BadgeID>
                                            <xsl:value-of select="BadgeID"/>
                                        </BadgeID>
                                        <CurrentRoleID>
                                            <xsl:value-of select="number(RoleID)"/>
                                        </CurrentRoleID>
                                    </Operator>
                                </xsl:for-each>
                            </ProductionOperators>
                            <Tools>
                                <xsl:for-each select="dilMessage">
                                    <xsl:variable name="var3_cur" select="."/>
                                    <Tool>
                                        <Position>
                                            <Name>
                                                <xsl:value-of select="Body/ObjectInfo/UnitInfo/ProductionInfo/Equipments/Equipment"/>
                                            </Name>
                                        </Position>
                                    </Tool>
                                </xsl:for-each>
                            </Tools>
                        </ProductionInfo>
                    </UnitInfo>
                </ObjectInfo>
            </Body>
        </dilMessage>
    </xsl:template>
</xsl:stylesheet>


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