XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 26 Jul 2007 09:14 AM
Hello helpful people,

I am using a JAXP application to modify the content of an xml document. The modifications are done using DOM in the java application, and in the end I am trying to output the result tree by binding the source tree to the following identity style sheet:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:ibml="http://ibml.jpmorgan.com/2005"
extension-element-prefixes="FpML ibml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

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


</xsl:stylesheet>


However, my style sheet leaves out all the prefixes of the source document and outputs the tag names without prefixes. for example, an element named <ibml:equity> in the source will appear as <equity> in the result. How do I copy the tag names prefixes such as "ibml" (all declared in namespaces in the source document) as well?

Many thanks,

Dorian

Postnext
Jan VerhoekSubject: Copy an xml document including the elements prefixes
Author: Jan Verhoek
Date: 26 Jul 2007 12:16 PM
Apart from the fact that your template could just look like:
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

I tried yours and it copied my namespaces into the result xml.

How do your first lines of xml look like?

Jan

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 26 Jul 2007 12:43 PM
Originally Posted: 26 Jul 2007 12:38 PM
Hello Jan, these are the first lines of my xml document:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:iml="http://iml.usb.com/2005" imlVersion="1-1" version="4-2" xsi:type="iml:CreateSendRequest" xsi:schemaLocation="http://iml.usb.com/2005 ../../../src/xsd/IML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd">

followed by children of the FpML element


I need advice on how to modify the following style sheet such as to include the "iml:" prefixes in the copy

xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:iml="http://ibml.usb.com/2005"
extension-element-prefixes="FpML iml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


Thanks in advance for the help,

Dorian

Postnext
(Deleted User) Subject: Copy an xml document including the elements prefixes
Author: (Deleted User)
Date: 27 Jul 2007 05:51 AM
Hi Dorian,
if you want to force a specific namespace prefix in the output you should use

<xsl:namespace-alias stylesheet-prefix="" result-prefix="ibml"/>

even if it's not clear to me which prefix you really want to redefine (the XML fragment you posted uses the default namespace for the FpML namespace, not for the ibml one)

Alberto

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 06:02 AM
Hi Alberto,

You can see the style sheet I am using, it was posted before. The problem I have is the elements prefixed with ibml come out without prefix, so for example <ibml:equity> comes out as <equity>. I want the unprefixed elements to stay unprefixed, and the prefixed ones to keep their prefix. How do I implement that in my style sheet?

Postnext
(Deleted User) Subject: Copy an xml document including the elements prefixes
Author: (Deleted User)
Date: 27 Jul 2007 06:43 AM
Hi Dorian,
you posted the stylesheet, but you didn't post the input XML; also, the result XML is displayed only with the first tag, so we don't see the equity node you are referring to. If you need further assistance, please provide both the input and the result XML.

Thanks,
Alberto

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:04 AM
ok, I was a bit reluctant to post the input file because of data protection issues, but here it is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ibml="http://ibml.usb.com/2005" ibmlVersion="1-1" version="4-2" xsi:type="ibml:CreateTradeRequest" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">160507001</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/party-id">MAMA-LN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070516001</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<ibml:processingInformation xsi:type="ibml:TradeProcessingInformation">
<ibml:booking>
<ibml:dealerReference href="Trader"/>
<ibml:bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</ibml:bookId>
<ibml:owner>true</ibml:owner>
<ibml:primaryCounterparty href="Party_Other"/>
<ibml:bookingComment>
<ibml:authorReference href="User"/>
<ibml:commentTimestamp>2007-02-11T10:00:01</ibml:commentTimestamp>
<ibml:text>SIT Test Case 1 - Success</ibml:text>
</ibml:bookingComment>
<ibml:dealingCapacity>PRINCIPAL</ibml:dealingCapacity>
</ibml:booking>
<ibml:audit>
<ibml:auditType>Entered</ibml:auditType>
<ibml:auditorReference href="User"/>
<ibml:auditTimestamp>2007-02-11T10:00:01</ibml:auditTimestamp>
</ibml:audit>
<ibml:reporting>
<ibml:exchangeReporting>
<ibml:exchangeReportingItem>
<ibml:reportingType>TradeReportType</ibml:reportingType>
<ibml:reportedValue>O</ibml:reportedValue>
</ibml:exchangeReportingItem>
<ibml:exchangeReportingItem>
<ibml:reportingType>SpecialConditions</ibml:reportingType>
<ibml:reportedValue>SP</ibml:reportedValue>
</ibml:exchangeReportingItem>
</ibml:exchangeReporting>
</ibml:reporting>
</ibml:processingInformation>
</partyTradeInformation>
<ibml:tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</ibml:tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<ibml:equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<ibml:numberOfUnits>1000</ibml:numberOfUnits>
<ibml:unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</ibml:unitPrice>
<ibml:settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</ibml:settlementDate>
<ibml:settlementCurrency>GBP</ibml:settlementCurrency>
<ibml:equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</ibml:equity>
</ibml:equityContract>
</trade>
<ibml:party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</ibml:party>
<ibml:party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</ibml:party>
<ibml:person id="Trader">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
<ibml:person id="User">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
</FpML>



Now I am doing some modifications on the attributes and values of certain elements using DOM instructionx in JAXP. Finally, I bind the DOMsource file to the style sheet posted above just to output it identically in xml. And this is the output (all my DOM transformations are ok, but the "ibml" prefixes are missing in the ouput)

<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:ibml="http://ibml.usb.com/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ibmlVersion="1-1" version="4-2" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd" xsi:type="ibml:CreateTradeRequest">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">2707010</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/system">MAMALN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070724010</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<processingInformation xsi:type="ibml:TradeProcessingInformation">
<booking>
<dealerReference href="Trader"/>
<bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</bookId>
<owner>true</owner>
<primaryCounterparty href="Party_Other"/>
<bookingComment>
<authorReference href="User"/>
<commentTimestamp>2007-02-11T10:00:01</commentTimestamp>
<text>SIT Test Case 1 - Success</text>
</bookingComment>
<dealingCapacity>PRINCIPAL</dealingCapacity>
</booking>
<audit>
<auditType>Entered</auditType>
<auditorReference href="User"/>
<auditTimestamp>2007-02-11T10:00:01</auditTimestamp>
</audit>
<reporting>
<exchangeReporting>
<exchangeReportingItem>
<reportingType>TradeReportType</reportingType>
<reportedValue>O</reportedValue>
</exchangeReportingItem>
<exchangeReportingItem>
<reportingType>SpecialConditions</reportingType>
<reportedValue>SP</reportedValue>
</exchangeReportingItem>
</exchangeReporting>
</reporting>
</processingInformation>
</partyTradeInformation>
<tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<numberOfUnits>1000</numberOfUnits>
<unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</unitPrice>
<settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</settlementDate>
<settlementCurrency>GBP</settlementCurrency>
<equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</equity>
</equityContract>
</trade>
<party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</party>
<party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</party>
<person id="Trader">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
<person id="User">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
</FpML>


Once agin, my style sheet is:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:ibml="http://ibml.usb.com/2005"
extension-element-prefixes="FpML ibml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

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


</xsl:stylesheet>

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:05 AM
ok, I was a bit reluctant to post the input file because of data protection issues, but here it is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ibml="http://ibml.usb.com/2005" ibmlVersion="1-1" version="4-2" xsi:type="ibml:CreateTradeRequest" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">160507001</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/party-id">MAMA-LN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070516001</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<ibml:processingInformation xsi:type="ibml:TradeProcessingInformation">
<ibml:booking>
<ibml:dealerReference href="Trader"/>
<ibml:bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</ibml:bookId>
<ibml:owner>true</ibml:owner>
<ibml:primaryCounterparty href="Party_Other"/>
<ibml:bookingComment>
<ibml:authorReference href="User"/>
<ibml:commentTimestamp>2007-02-11T10:00:01</ibml:commentTimestamp>
<ibml:text>SIT Test Case 1 - Success</ibml:text>
</ibml:bookingComment>
<ibml:dealingCapacity>PRINCIPAL</ibml:dealingCapacity>
</ibml:booking>
<ibml:audit>
<ibml:auditType>Entered</ibml:auditType>
<ibml:auditorReference href="User"/>
<ibml:auditTimestamp>2007-02-11T10:00:01</ibml:auditTimestamp>
</ibml:audit>
<ibml:reporting>
<ibml:exchangeReporting>
<ibml:exchangeReportingItem>
<ibml:reportingType>TradeReportType</ibml:reportingType>
<ibml:reportedValue>O</ibml:reportedValue>
</ibml:exchangeReportingItem>
<ibml:exchangeReportingItem>
<ibml:reportingType>SpecialConditions</ibml:reportingType>
<ibml:reportedValue>SP</ibml:reportedValue>
</ibml:exchangeReportingItem>
</ibml:exchangeReporting>
</ibml:reporting>
</ibml:processingInformation>
</partyTradeInformation>
<ibml:tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</ibml:tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<ibml:equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<ibml:numberOfUnits>1000</ibml:numberOfUnits>
<ibml:unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</ibml:unitPrice>
<ibml:settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</ibml:settlementDate>
<ibml:settlementCurrency>GBP</ibml:settlementCurrency>
<ibml:equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</ibml:equity>
</ibml:equityContract>
</trade>
<ibml:party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</ibml:party>
<ibml:party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</ibml:party>
<ibml:person id="Trader">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
<ibml:person id="User">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
</FpML>



Now I am doing some modifications on the attributes and values of certain elements using DOM instructionx in JAXP. Finally, I bind the DOMsource file to the style sheet posted above just to output it identically in xml. And this is the output (all my DOM transformations are ok, but the "ibml" prefixes are missing in the ouput)

<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:ibml="http://ibml.usb.com/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ibmlVersion="1-1" version="4-2" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd" xsi:type="ibml:CreateTradeRequest">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">2707010</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/system">MAMALN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070724010</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<processingInformation xsi:type="ibml:TradeProcessingInformation">
<booking>
<dealerReference href="Trader"/>
<bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</bookId>
<owner>true</owner>
<primaryCounterparty href="Party_Other"/>
<bookingComment>
<authorReference href="User"/>
<commentTimestamp>2007-02-11T10:00:01</commentTimestamp>
<text>SIT Test Case 1 - Success</text>
</bookingComment>
<dealingCapacity>PRINCIPAL</dealingCapacity>
</booking>
<audit>
<auditType>Entered</auditType>
<auditorReference href="User"/>
<auditTimestamp>2007-02-11T10:00:01</auditTimestamp>
</audit>
<reporting>
<exchangeReporting>
<exchangeReportingItem>
<reportingType>TradeReportType</reportingType>
<reportedValue>O</reportedValue>
</exchangeReportingItem>
<exchangeReportingItem>
<reportingType>SpecialConditions</reportingType>
<reportedValue>SP</reportedValue>
</exchangeReportingItem>
</exchangeReporting>
</reporting>
</processingInformation>
</partyTradeInformation>
<tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<numberOfUnits>1000</numberOfUnits>
<unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</unitPrice>
<settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</settlementDate>
<settlementCurrency>GBP</settlementCurrency>
<equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</equity>
</equityContract>
</trade>
<party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</party>
<party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</party>
<person id="Trader">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
<person id="User">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
</FpML>


Once agin, my style sheet is:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:ibml="http://ibml.usb.com/2005"
extension-element-prefixes="FpML ibml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

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


</xsl:stylesheet>

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:08 AM
ok, I was a bit reluctant to post the input file because of data protection issues, but here it is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ibml="http://ibml.usb.com/2005" ibmlVersion="1-1" version="4-2" xsi:type="ibml:CreateTradeRequest" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">160507001</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/party-id">MAMA-LN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070516001</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<ibml:processingInformation xsi:type="ibml:TradeProcessingInformation">
<ibml:booking>
<ibml:dealerReference href="Trader"/>
<ibml:bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</ibml:bookId>
<ibml:owner>true</ibml:owner>
<ibml:primaryCounterparty href="Party_Other"/>
<ibml:bookingComment>
<ibml:authorReference href="User"/>
<ibml:commentTimestamp>2007-02-11T10:00:01</ibml:commentTimestamp>
<ibml:text>SIT Test Case 1 - Success</ibml:text>
</ibml:bookingComment>
<ibml:dealingCapacity>PRINCIPAL</ibml:dealingCapacity>
</ibml:booking>
<ibml:audit>
<ibml:auditType>Entered</ibml:auditType>
<ibml:auditorReference href="User"/>
<ibml:auditTimestamp>2007-02-11T10:00:01</ibml:auditTimestamp>
</ibml:audit>
<ibml:reporting>
<ibml:exchangeReporting>
<ibml:exchangeReportingItem>
<ibml:reportingType>TradeReportType</ibml:reportingType>
<ibml:reportedValue>O</ibml:reportedValue>
</ibml:exchangeReportingItem>
<ibml:exchangeReportingItem>
<ibml:reportingType>SpecialConditions</ibml:reportingType>
<ibml:reportedValue>SP</ibml:reportedValue>
</ibml:exchangeReportingItem>
</ibml:exchangeReporting>
</ibml:reporting>
</ibml:processingInformation>
</partyTradeInformation>
<ibml:tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</ibml:tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<ibml:equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<ibml:numberOfUnits>1000</ibml:numberOfUnits>
<ibml:unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</ibml:unitPrice>
<ibml:settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</ibml:settlementDate>
<ibml:settlementCurrency>GBP</ibml:settlementCurrency>
<ibml:equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</ibml:equity>
</ibml:equityContract>
</trade>
<ibml:party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</ibml:party>
<ibml:party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</ibml:party>
<ibml:person id="Trader">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
<ibml:person id="User">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
</FpML>



Now I am doing some modifications on the attributes and values of certain elements using DOM instructionx in JAXP. Finally, I bind the DOMsource file to the style sheet posted above just to output it identically in xml. And this is the output (all my DOM transformations are ok, but the "ibml" prefixes are missing in the ouput)

<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:ibml="http://ibml.usb.com/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ibmlVersion="1-1" version="4-2" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd" xsi:type="ibml:CreateTradeRequest">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">2707010</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/system">MAMALN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070724010</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<processingInformation xsi:type="ibml:TradeProcessingInformation">
<booking>
<dealerReference href="Trader"/>
<bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</bookId>
<owner>true</owner>
<primaryCounterparty href="Party_Other"/>
<bookingComment>
<authorReference href="User"/>
<commentTimestamp>2007-02-11T10:00:01</commentTimestamp>
<text>SIT Test Case 1 - Success</text>
</bookingComment>
<dealingCapacity>PRINCIPAL</dealingCapacity>
</booking>
<audit>
<auditType>Entered</auditType>
<auditorReference href="User"/>
<auditTimestamp>2007-02-11T10:00:01</auditTimestamp>
</audit>
<reporting>
<exchangeReporting>
<exchangeReportingItem>
<reportingType>TradeReportType</reportingType>
<reportedValue>O</reportedValue>
</exchangeReportingItem>
<exchangeReportingItem>
<reportingType>SpecialConditions</reportingType>
<reportedValue>SP</reportedValue>
</exchangeReportingItem>
</exchangeReporting>
</reporting>
</processingInformation>
</partyTradeInformation>
<tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<numberOfUnits>1000</numberOfUnits>
<unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</unitPrice>
<settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</settlementDate>
<settlementCurrency>GBP</settlementCurrency>
<equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</equity>
</equityContract>
</trade>
<party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</party>
<party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</party>
<person id="Trader">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
<person id="User">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
</FpML>


Once agin, my style sheet is:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:ibml="http://ibml.usb.com/2005"
extension-element-prefixes="FpML ibml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

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


</xsl:stylesheet>

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:10 AM
ok, I was a bit reluctant to post the input file because of data protection issues, but here it is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ibml="http://ibml.usb.com/2005" ibmlVersion="1-1" version="4-2" xsi:type="ibml:CreateTradeRequest" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">160507001</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/party-id">MAMA-LN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070516001</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<ibml:processingInformation xsi:type="ibml:TradeProcessingInformation">
<ibml:booking>
<ibml:dealerReference href="Trader"/>
<ibml:bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</ibml:bookId>
<ibml:owner>true</ibml:owner>
<ibml:primaryCounterparty href="Party_Other"/>
<ibml:bookingComment>
<ibml:authorReference href="User"/>
<ibml:commentTimestamp>2007-02-11T10:00:01</ibml:commentTimestamp>
<ibml:text>SIT Test Case 1 - Success</ibml:text>
</ibml:bookingComment>
<ibml:dealingCapacity>PRINCIPAL</ibml:dealingCapacity>
</ibml:booking>
<ibml:audit>
<ibml:auditType>Entered</ibml:auditType>
<ibml:auditorReference href="User"/>
<ibml:auditTimestamp>2007-02-11T10:00:01</ibml:auditTimestamp>
</ibml:audit>
<ibml:reporting>
<ibml:exchangeReporting>
<ibml:exchangeReportingItem>
<ibml:reportingType>TradeReportType</ibml:reportingType>
<ibml:reportedValue>O</ibml:reportedValue>
</ibml:exchangeReportingItem>
<ibml:exchangeReportingItem>
<ibml:reportingType>SpecialConditions</ibml:reportingType>
<ibml:reportedValue>SP</ibml:reportedValue>
</ibml:exchangeReportingItem>
</ibml:exchangeReporting>
</ibml:reporting>
</ibml:processingInformation>
</partyTradeInformation>
<ibml:tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</ibml:tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<ibml:equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<ibml:numberOfUnits>1000</ibml:numberOfUnits>
<ibml:unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</ibml:unitPrice>
<ibml:settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</ibml:settlementDate>
<ibml:settlementCurrency>GBP</ibml:settlementCurrency>
<ibml:equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</ibml:equity>
</ibml:equityContract>
</trade>
<ibml:party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</ibml:party>
<ibml:party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</ibml:party>
<ibml:person id="Trader">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
<ibml:person id="User">
<ibml:personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</ibml:personId>
</ibml:person>
</FpML>



Now I am doing some modifications on the attributes and values of certain elements using DOM instructionx in JAXP. Finally, I bind the DOMsource file to the style sheet posted above just to output it identically in xml. And this is the output (all my DOM transformations are ok, but the "ibml" prefixes are missing in the ouput)

<FpML xmlns="http://www.fpml.org/2005/FpML-4-2" xmlns:ibml="http://ibml.usb.com/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ibmlVersion="1-1" version="4-2" xsi:schemaLocation="http://ibml.usb.com/2005 ../../../src/xsd/IBML.xsd http://www.fpml.org/2005/FpML-4-2 ../../../src/xsd/FpML-4-2-TR/fpml-main-4-2.xsd" xsi:type="ibml:CreateTradeRequest">
<header>
<messageId messageIdScheme="http://mama-ln.usb.com/coding-scheme/message-id">2707010</messageId>
<sentBy partyIdScheme="http://ibml.usb.com/coding-scheme/system">MAMALN</sentBy>
<creationTimestamp>2007-02-11T00:00:01</creationTimestamp>
</header>
<trade>
<tradeHeader xsi:type="ibml:TradeHeader">
<partyTradeIdentifier>
<partyReference href="Party_BMM"/>
<tradeId tradeIdScheme="http://mama-ln.usb.com/coding-scheme/trade-id">20070724010</tradeId>
</partyTradeIdentifier>
<partyTradeInformation xsi:type="ibml:PartyTradeInformation">
<partyReference href="Party_BMM"/>
<processingInformation xsi:type="ibml:TradeProcessingInformation">
<booking>
<dealerReference href="Trader"/>
<bookId bookIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</bookId>
<owner>true</owner>
<primaryCounterparty href="Party_Other"/>
<bookingComment>
<authorReference href="User"/>
<commentTimestamp>2007-02-11T10:00:01</commentTimestamp>
<text>SIT Test Case 1 - Success</text>
</bookingComment>
<dealingCapacity>PRINCIPAL</dealingCapacity>
</booking>
<audit>
<auditType>Entered</auditType>
<auditorReference href="User"/>
<auditTimestamp>2007-02-11T10:00:01</auditTimestamp>
</audit>
<reporting>
<exchangeReporting>
<exchangeReportingItem>
<reportingType>TradeReportType</reportingType>
<reportedValue>O</reportedValue>
</exchangeReportingItem>
<exchangeReportingItem>
<reportingType>SpecialConditions</reportingType>
<reportedValue>SP</reportedValue>
</exchangeReportingItem>
</exchangeReporting>
</reporting>
</processingInformation>
</partyTradeInformation>
<tradeType tradeTypeScheme="http://sphinx.usb.com/coding-scheme/trade-type-id">DELTA CROSS</tradeType>
<tradeDate id="TradeDate">2007-03-02</tradeDate>
</tradeHeader>
<equityContract>
<buyerPartyReference href="Party_BMM"/>
<sellerPartyReference href="Party_Other"/>
<numberOfUnits>1000</numberOfUnits>
<unitPrice>
<currency>GBP</currency>
<amount>2</amount>
</unitPrice>
<settlementDate>
<adjustableDate>
<unadjustedDate>2007-03-05T12:00:00</unadjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</adjustableDate>
</settlementDate>
<settlementCurrency>GBP</settlementCurrency>
<equity>
<instrumentId instrumentIdScheme="http://eis.usb.com/coding-scheme/instrument-id">416271</instrumentId>
<exchangeId exchangeIdScheme="http://eis.usb.com/coding-scheme/exchange-id">10000010</exchangeId>
</equity>
</equityContract>
</trade>
<party id="Party_BMM">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/book-id">10063893</partyId>
</party>
<party id="Party_Other">
<partyId partyIdScheme="http://eis.usb.com/coding-scheme/party-account-id">1059834</partyId>
</party>
<person id="Trader">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
<person id="User">
<personId personIdScheme="http://eis.usb.com/coding-scheme/pyr-user-id">pleech</personId>
</person>
</FpML>


Once agin, my style sheet is:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:FpML="http://www.fpml.org/2005/FpML-4-2"
xmlns:ibml="http://ibml.usb.com/2005"
extension-element-prefixes="FpML ibml">

<xsl:output method="xml" version="1.0" indent="yes" omit-xml-declaration="yes"/>

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


</xsl:stylesheet>

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:11 AM
Ihave no idea why that got posted so many times, I could swear I only clicked once

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:18 AM
Ihave no idea why that got posted so many times, I could swear I only clicked once

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 27 Jul 2007 07:21 AM
Ihave no idea why that got posted so many times, I could swear I only clicked once

Postnext
(Deleted User) Subject: Copy an xml document including the elements prefixes
Author: (Deleted User)
Date: 27 Jul 2007 09:36 AM
Hi Dorian,
the duplicate messages are usually generated when you press the 'refresh' button of your browser on the page that is generated after you inserted the post (as the browser sends the same POSTDATA informations used to generate the page); in any case, the author of the post can delete his own messages by clicking on the 'delete' action on top of it.

As for the namespace prefix problem, the problem is not in the original XML nor in the stylesheet (if you process the original file with the stylesheet, you get the ibml prefixes in the output), so the error lies in the JAXP code. If you don't want to post it in a public forum, you can send it to stylus-field-report@progress.com.

Hope this helps,
Alberto

Postnext
(Deleted User) Subject: Copy an xml document including the elements prefixes
Author: (Deleted User)
Date: 27 Jul 2007 12:34 PM
Hi Dorian,
you are parsing the XML file without namespaces, so you are stripping every prefix from the nodes. You will need to add a call to

factory.setNamespaceAware(true);

As a side effect, you will have to change your calls to getElementsByTagName with getElementsByTagNameNS.

Hope this helps,
Alberto

Postnext
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 30 Jul 2007 04:07 AM
Hello Alberto,

Thank you very much for your input and help. I will now try to make the changes you suggested.

Posttop
Dorian DongmoSubject: Copy an xml document including the elements prefixes
Author: Dorian Dongmo
Date: 30 Jul 2007 05:25 AM
Hi Alberto,

Problem solved. Many many thanks.

Dorian

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.