XSLT generates values, but not tags

W

wickedbomb

I have an XSL that was auto-generated by mapping two XML Schema XSD's.
When I run the transformation, I get the values output to the console,
but none of the appropriate tags are appearing... Here are the files:

XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by
Aerosystems International Inc (Aerosystems International Inc) -->
<!--Sample XML file generated by XMLSPY v2004 rel. 3 U
(http://www.xmlspy.com)-->
<WorkOrder xmlns="http://xmlns.web.boeing.com/Aerospace_Support/SDS/"
xmlns:eek:a="http://www.openapplications.org/oagis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.web.boeing.com/Aerospace_Support/SDS/
...\Resources\Nouns\WorkOrder.xsd">
<WorkOrderDetails>
<Uid>String</Uid>
<ExternalId>String</ExternalId>
<Type>Manual</Type>
<Name>APU clutch warped</Name>
<Description>APU clutch warped</Description>
<WorkDone>String</WorkDone>
<Position>15B05 00</Position>
<Claim>
<ChildUid>String</ChildUid>
</Claim>

<Status>Accepted</Status>
<Code>15B01-1</Code>
<FaultClassification>701</FaultClassification>
<DelayCode>String</DelayCode>
<HowWhenDiscovered>1</HowWhenDiscovered>
<MalfunctionEffect>5</MalfunctionEffect>
<TaskDetails>
<TaskCode>15B01-1</TaskCode>
<Name>Remove APU</Name>
<Position>15B</Position>
<Status>Pending</Status>
<TradeBookingRecord>
<TradeType>String</TradeType>
<TradeSkill>String</TradeSkill>
<OperativeHours>3.14159</OperativeHours>
<SupervisorHours>3.14159</SupervisorHours>
<SelfSupervized>1</SelfSupervized>
</TradeBookingRecord>
</TaskDetails>
<TaskDetails>
<TaskCode>15B01-2</TaskCode>
<Name>Replace APU</Name>
<Position>15B</Position>
<Status>Pending</Status>
<TradeBookingRecord>
<TradeType>String</TradeType>
<TradeSkill>String</TradeSkill>
<OperativeHours>3.14159</OperativeHours>
<SupervisorHours>3.14159</SupervisorHours>
<SelfSupervized>1</SelfSupervized>
</TradeBookingRecord>
</TaskDetails>
</WorkOrderDetails>
</WorkOrder>

XSL:

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

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

Refer to the Altova MapForce 2005 Documentation for further details.
http://www.altova.com/mapforce
-->
<xsl:stylesheet version="2.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"
xmlns:eek:a="http://www.openapplications.org/oagis"
xmlns:sds="http://xmlns.web.boeing.com/Aerospace_Support/SDS"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
exclude-result-prefixes="xs fn">
<xsl:eek:utput method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="WorkOrder">
<sds:WorkOrder>

<xsl:for-each select="Details">
<sds:WorkOrderDetails>
<xsl:for-each select="Uid">
<sds:Uid>
<xsl:value-of select="."/>
</sds:Uid>
</xsl:for-each>
<xsl:for-each select="ExternalId">
<sds:ExternalId>
<xsl:value-of select="."/>
</sds:ExternalId>
</xsl:for-each>
<xsl:for-each select="WorkOrderType">
<sds:Type>
<xsl:value-of select="."/>
</sds:Type>
</xsl:for-each>
<xsl:for-each select="Name">
<sds:Name>
<xsl:value-of select="."/>
</sds:Name>
</xsl:for-each>
<xsl:for-each select="Description">
<sds:Description>
<xsl:value-of select="."/>
</sds:Description>
</xsl:for-each>
<xsl:for-each select="WorkDone">
<sds:WorkDone>
<xsl:value-of select="."/>
</sds:WorkDone>
</xsl:for-each>
<xsl:for-each select="Position">
<sds:position>
<xsl:value-of select="."/>
</sds:position>
</xsl:for-each>
<xsl:for-each select="Claim">
<sds:Claim>
<xsl:for-each select="ChildExternalId">
<sds:ChildExternalId>
<xsl:value-of select="."/>
</sds:ChildExternalId>
</xsl:for-each>
<xsl:for-each select="ChildUid">
<sds:ChildUid>
<xsl:value-of select="."/>
</sds:ChildUid>
</xsl:for-each>
</sds:Claim>
</xsl:for-each>
<xsl:for-each select="WorkOrderStatus">
<sds:Status>
<xsl:value-of select="."/>
</sds:Status>
</xsl:for-each>
<xsl:for-each select="Code">
<sds:Code>
<xsl:value-of select="."/>
</sds:Code>
</xsl:for-each>
<xsl:for-each select="FaultClassification">
<sds:FaultClassification>
<xsl:value-of select="."/>
</sds:FaultClassification>
</xsl:for-each>
<xsl:for-each select="DelayCode">
<sds:DelayCode>
<xsl:value-of select="."/>
</sds:DelayCode>
</xsl:for-each>
<xsl:for-each select="HowWhenDiscovered">
<sds:HowWhenDiscovered>
<xsl:value-of select="."/>
</sds:HowWhenDiscovered>
</xsl:for-each>
<xsl:for-each select="MalfunctionEffect">
<sds:MalfunctionEffect>
<xsl:value-of select="."/>
</sds:MalfunctionEffect>
</xsl:for-each>
<xsl:for-each select="TaskDetails">
<sds:TaskDetails>
<xsl:for-each select="TaskCode">
<sds:TaskCode>
<xsl:value-of select="."/>
</sds:TaskCode>
</xsl:for-each>
<xsl:for-each select="Name">
<sds:Name>
<xsl:value-of select="."/>
</sds:Name>
</xsl:for-each>
<xsl:for-each select="Position">
<sds:position>
<xsl:value-of select="."/>
</sds:position>
</xsl:for-each>
<xsl:for-each select="TaskStatus">
<sds:Status>
<xsl:value-of select="."/>
</sds:Status>
</xsl:for-each>
<xsl:for-each select="TradeBookingRecord">
<sds:TradeBookingRecord>
<xsl:for-each select="TradeType">
<sds:TradeType>
<xsl:value-of select="."/>
</sds:TradeType>
</xsl:for-each>
<xsl:for-each select="TradeSkill">
<sds:TradeSkill>
<xsl:value-of select="."/>
</sds:TradeSkill>
</xsl:for-each>
<xsl:for-each select="OperativeHours">
<sds:OperativeHours>
<xsl:value-of select="."/>
</sds:OperativeHours>
</xsl:for-each>
<xsl:for-each select="SupervisorHours">
<sds:SupervisorHours>
<xsl:value-of select="."/>
</sds:SupervisorHours>
</xsl:for-each>
<xsl:for-each select="SelfSupervized">
<sds:SelfSupervized>
<xsl:value-of select="."/>
</sds:SelfSupervized>
</xsl:for-each>
</sds:TradeBookingRecord>
</xsl:for-each>
</sds:TaskDetails>
</xsl:for-each>
</sds:WorkOrderDetails>
</xsl:for-each>
</sds:WorkOrder>
</xsl:template>
</xsl:stylesheet>


OUTPUT:

<?xml version="1.0" encoding="UTF-8"?>

String
String
Manual
APU clutch warped
APU clutch warped
String
15B05 00

String


Accepted
15B01-1
701
String
1
5

15B01-1
Remove APU
15B
Pending

String
String
3.14159
3.14159
1



15B01-2
Replace APU
15B
Pending

String
String
3.14159
3.14159
1



Thanks!

Raj
 
D

David Carlisle

Your stylesheet only has one template, and that doesn't match your
input, so you just get the result of the default templates, which
copies text nodes but not element nodes.

<xsl:template match="WorkOrder">

matches WorkOrder in no namespace but you have

WorkOrder in namespace
http://xmlns.web.boeing.com/Aerospace_Support/SDS/

You need to declare

xmlns:x="http://xmlns.web.boeing.com/Aerospace_Support/SDS/" in your
stylesheet and then use x: on all element names in the stylesheet.
or use the new xslt2 feature of changing the defaultr namespace for
xpath
default-element-namespace="http://xmlns.web.boeing.com/Aerospace_Support/SDS/"
on xsl:stylesheet.


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top