CMSIRL
asked on
Microsoft Friendly XSLT
I'm trying to mirror a java program in C Sharp - part of the program is an XSL transformation of an existing XML document. The code I've been given for the java version is
<?xml version="1.0"?>
<dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/CM/envelope" xmlns:ir="http://www.govtalk.gov.uk/taxation/CISrequest">
<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<dsig:XPath>
count(ancestor-or-self::no de()|/gt:G ovTalkMess age/gt:Bod y)=count(a ncestor-or -self::nod e())
and count(self::ir:IRmark)=0
and count(../self::ir:IRmark)= 0
</dsig:XPath>
</dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
</dsig:Transforms>
However when i try and load that into my CSharp transformer object I get an XSLT compile error
The XML document its transforming is
<?xml version="1.0"?>
<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
<EnvelopeVersion>1.0</Enve lopeVersio n>
<Header>
<MessageDetails>
<Class>IR-CIS-VERIFY</Clas s>
<Qualifier>request</Qualif ier>
<Function>submit</Function >
<CorrelationID />
<ResponseEndPoint />
<Transformation>XML</Trans formation>
<GatewayTest>1</GatewayTes t>
<GatewayTimestamp />
</MessageDetails>
<SenderDetails>
<IDAuthentication>
<SenderID>CISRUSER1015</Se nderID>
<Authentication>
<Method>clear</Method>
<Value>testing1</Value>
</Authentication>
</IDAuthentication>
</SenderDetails>
</Header>
<GovTalkDetails>
<Keys>
<Key Type="TaxOfficeNumber">123 </Key>
<Key Type="TaxOfficeReference"> R216</Key>
</Keys>
<TargetDetails>
<Organisation>IR</Organisa tion>
</TargetDetails>
<ChannelRouting>
<Channel>
<URI>0883</URI>
</Channel>
</ChannelRouting>
</GovTalkDetails>
<Body>
<IRenvelope xmlns="http://www.govtalk.gov.uk/taxation/CISrequest">
<IRheader>
<Keys>
<Key Type="TaxOfficeNumber">123 </Key>
<Key Type="TaxOfficeReference"> R216</Key>
</Keys>
<PeriodEnd>2007-03-31</Per iodEnd>
<DefaultCurrency>GBP</Defa ultCurrenc y>
<IRmark Type="generic"></IRmark>
<Sender>Employer</Sender>
</IRheader>
<CISrequest>
<Contractor>
<UTR>4325648152</UTR>
<AOref>123PP87654321</AOre f>
</Contractor>
<Subcontractor>
<Action>verify</Action>
<Type>partnership</Type>
<TradingName>Foundations</ TradingNam e>
<WorksRef>WR3000</WorksRef >
<UTR>1234567890</UTR>
<CRN>AB123456</CRN>
<NINO>PR456789B</NINO>
<Partnership>
<Name>Mark & Sons</Name>
<UTR>0123456789</UTR>
</Partnership>
<Address>
<Line>21 High Street</Line>
<Line>Wellington</Line>
<Line>Telford</Line>
<Line>Shropshire</Line>
<PostCode>BD18</PostCode>
<Country>UK</Country>
</Address>
<Telephone>01952123456</Te lephone>
</Subcontractor>
<Declaration>yes</Declarat ion>
</CISrequest>
</IRenvelope>
</Body>
</GovTalkMessage>
the object of the XSLT transformation is to place the xmlns attribute of the GovTalkMessage in the body tag and extract the body tag then and its contents. Has anyone got any microsoft friendly XML to do this.
<?xml version="1.0"?>
<dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/CM/envelope" xmlns:ir="http://www.govtalk.gov.uk/taxation/CISrequest">
<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<dsig:XPath>
count(ancestor-or-self::no
and count(self::ir:IRmark)=0
and count(../self::ir:IRmark)=
</dsig:XPath>
</dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
</dsig:Transforms>
However when i try and load that into my CSharp transformer object I get an XSLT compile error
The XML document its transforming is
<?xml version="1.0"?>
<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
<EnvelopeVersion>1.0</Enve
<Header>
<MessageDetails>
<Class>IR-CIS-VERIFY</Clas
<Qualifier>request</Qualif
<Function>submit</Function
<CorrelationID />
<ResponseEndPoint />
<Transformation>XML</Trans
<GatewayTest>1</GatewayTes
<GatewayTimestamp />
</MessageDetails>
<SenderDetails>
<IDAuthentication>
<SenderID>CISRUSER1015</Se
<Authentication>
<Method>clear</Method>
<Value>testing1</Value>
</Authentication>
</IDAuthentication>
</SenderDetails>
</Header>
<GovTalkDetails>
<Keys>
<Key Type="TaxOfficeNumber">123
<Key Type="TaxOfficeReference">
</Keys>
<TargetDetails>
<Organisation>IR</Organisa
</TargetDetails>
<ChannelRouting>
<Channel>
<URI>0883</URI>
</Channel>
</ChannelRouting>
</GovTalkDetails>
<Body>
<IRenvelope xmlns="http://www.govtalk.gov.uk/taxation/CISrequest">
<IRheader>
<Keys>
<Key Type="TaxOfficeNumber">123
<Key Type="TaxOfficeReference">
</Keys>
<PeriodEnd>2007-03-31</Per
<DefaultCurrency>GBP</Defa
<IRmark Type="generic"></IRmark>
<Sender>Employer</Sender>
</IRheader>
<CISrequest>
<Contractor>
<UTR>4325648152</UTR>
<AOref>123PP87654321</AOre
</Contractor>
<Subcontractor>
<Action>verify</Action>
<Type>partnership</Type>
<TradingName>Foundations</
<WorksRef>WR3000</WorksRef
<UTR>1234567890</UTR>
<CRN>AB123456</CRN>
<NINO>PR456789B</NINO>
<Partnership>
<Name>Mark & Sons</Name>
<UTR>0123456789</UTR>
</Partnership>
<Address>
<Line>21 High Street</Line>
<Line>Wellington</Line>
<Line>Telford</Line>
<Line>Shropshire</Line>
<PostCode>BD18</PostCode>
<Country>UK</Country>
</Address>
<Telephone>01952123456</Te
</Subcontractor>
<Declaration>yes</Declarat
</CISrequest>
</IRenvelope>
</Body>
</GovTalkMessage>
the object of the XSLT transformation is to place the xmlns attribute of the GovTalkMessage in the body tag and extract the body tag then and its contents. Has anyone got any microsoft friendly XML to do this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If that is indeed the problem then you will want to check out the MSDN tutorial on using msxsl:script:
http://msdn2.microsoft.com/en-us/library/wxaw5z5e.aspx
if you are using the XslCompiledTransform method to load this you may need to note that the default REQUIRED namespace contained in the XSLT is http://www.w3.org/1999/XSL/Transform.