OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XSL Transformation help

[ Lists Home | Date Index | Thread Index ]

Hi,

I have the following XML and XSL files. I need to transform the XML doc to another doc given below with XSL. I am getting the output but with some extra unwanted XML tags. Can somebody throw some light on how to transform the XML document to get the exact output that I want.

xmlfile.xml
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Check - Only User hand keyed the data-->
<TenderAuthorizationRequest>
	<RetailStoreID>000427</RetailStoreID>
	<WorkstationID>01</WorkstationID>
	<SalespersonID>12345</SalespersonID>
	<TransactionNumber>12345</TransactionNumber>
</TenderAuthorizationRequest>

xslfile.xsl
------------------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/> 
	<!-- Match the root node -->
	<xsl:template match="*|@*|text()">
		<xsl:copy>
			<xsl:apply-templates select="*|@*|text()"/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="RetailStoreID">
		<element name="DestinationSystemID" type="bcd" totalDigits="6" whiteSpace="0" value="0"/>
		<element name="SourceSystemID" type="bcd" totalDigits="6" value="{//RetailStoreID}"/>
		<element name="FunctionCode" type="bcd" totalDigits="2" value="0"/>
		<element name="StatusCode" type="bcd" totalDigits="3" value="0"/>
		<elementBlock name="MessageLength" type="bcd" totalDigits="4" />
		<element name="SequenceBufferNumber" type="bcd" totalDigits="8" value="023F0000"/>
		<element name="SystemID" type="bcd" totalDigits="4" value="8862"/>
		<element name="RetailStoreID" type="bcd" totalDigits="6" value="{//RetailStoreID}"/>
	</xsl:template>
</xsl:stylesheet>

outputxsml.xml
-------------------------
<?xml version="1.0"?>
<TenderAuthorizationRequest>
	<version-record major="0" minor="1" revision="0" build="1000">
	</version-record>
	<element name="DestinationSystemID" type="bcd" totalDigits="6" whiteSpace="0" value="0"/>
	<element name="SourceSystemID" type="bcd" totalDigits="6" value="000427"/>
	<element name="FunctionCode" type="bcd" totalDigits="2" value="0"/>
	<element name="StatusCode" type="bcd" totalDigits="3" value="0"/>
	<elementBlock name="MessageLength" type="bcd" totalDigits="4"/>
	<element name="SequenceBufferNumber" type="bcd" totalDigits="8" value="023F0000"/>
	<element name="SystemID" type="bcd" totalDigits="4" value="8862"/>
	<element name="RetailStoreID" type="bcd" totalDigits="6" value="000427"/>
	<WorkstationID>01</WorkstationID>
	<SalespersonID>12345</SalespersonID>
	<TransactionNumber>12345</TransactionNumber>
</TenderAuthorizationRequest>

requiredoutputxml.xml
------------------------------------
<?xml version="1.0"?>
<TenderAuthorizationRequest>
	<version-record major="0" minor="1" revision="0" build="1000">
	</version-record>
	<element name="DestinationSystemID" type="bcd" totalDigits="6" whiteSpace="0" value="0"/>
	<element name="SourceSystemID" type="bcd" totalDigits="6" value="000427"/>
	<element name="FunctionCode" type="bcd" totalDigits="2" value="0"/>
	<element name="StatusCode" type="bcd" totalDigits="3" value="0"/>
	<elementBlock name="MessageLength" type="bcd" totalDigits="4"/>
	<element name="SequenceBufferNumber" type="bcd" totalDigits="8" value="023F0000"/>
	<element name="SystemID" type="bcd" totalDigits="4" value="8862"/>
	<element name="RetailStoreID" type="bcd" totalDigits="6" value="000427"/>
</TenderAuthorizationRequest>

Problem:
I do not want the following tags in the outputxml.xml file

	<WorkstationID>01</WorkstationID>
	<SalespersonID>12345</SalespersonID>
	<TransactionNumber>12345</TransactionNumber>


Thanks,
Ravi





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS