Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2013, 04:51 PM
Registered User
 
Join Date: May 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can i write xslt for the given xml?

Hello,

This is my input XML from this how can i write XSLT for this help me.

INPUT.XML
iso:GarageQuoteInqRs/iso:CommlAutoLineBusiness_EXTGarage/
iso:CommlGarageInfo_EXTGarage[LocationRef="ID_25",TypeOfBusinessCd_EXTGarage ='Service']/
iso:CommlCoverage_EXTProp[CoverageCd=ServiceGarageMedicalPaymentsLimited',Co verageCdDesc = Service Garage Medical Payments Limited Coverage,CoverageInd_EXTProp='1']/
iso:CreditOrSurcharge_EXTProp[CreditSurchargeCd='MedicalPayment']/iso:NumericValue/iso:FormatCurrencyAmt/iso:Amt
 
Old May 28th, 2013, 03:42 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You need to use [ code ] and [ / code ] tags around the XML.

Also you need to tell us what output you want your stylesheet to produce; giving the input to a program without the desired output is not much of a specification.

Also it's a good idea to tell us why you are having problems. How far did you get and where did you get stuck? This site isn't just a free coding service; it's to help people with problems.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old May 28th, 2013, 11:36 AM
Registered User
 
Join Date: May 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks McKay!!

This is my xml input
/QuoteObject/Insured/Quote/Location[UnitNumber = 'ID_25']
/BusinessAuto/Service/ServicePremiums/Worksheet/OtherThanCollision/SrvLot[Unit number =1]
/LossCost



this is how my output should look like
iso:GarageQuoteInqRs/iso:CommlAutoLineBusiness_EXTGarage/
iso:CommlGarageInfo_EXTGarage[LocationRef="ID_25",TypeOfBusinessCd_EXTGarage ='Service']
/iso:CommlCoverage_EXTProp[CoverageCd ='ServiceGaragePhysicalDamage',CoverageCdDesc='Ser vice Garage Physical Damage Coverage',Coverage',CoverageInd_EXTProp='1']
/iso:CreditOrSurcharge_EXTProp[CreditSurchargeCd='LossCostFactor']/iso:NumericValue/iso:FormatModFactor

& i need to write an xsl according to above structure.


My problem is, while considering the output structure, "iso:CommlGarageInfo_EXTGarage[LocationRef="ID_25",TypeOfBusinessCd_EXTGarage ='Service']"
i find LocationRef="ID_25",TypeOfBusinessCd_EXTGarage ='Service', what should i consider them as ?? attributes ?? child elements ?? if so, how should i write??
i have seen several examples , where LocationRef="ID_25" is written with condition & TypeOfBusinessCd_EXTGarage ='Service' is written within another tag(child tag).
am confused ?? plzz help me
 
Old May 28th, 2013, 05:04 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

As stated, you need to format your code correctly, otherwise it comes out unreadable. This forum uses the tags "[ c o d e ]" and "[ / c o d e ]" for this - type these with no spaces.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling xslt into xslt with different xml file ruchi_doda XSLT 0 February 28th, 2012 07:50 AM
XML broken after over write hamilton XML 2 January 8th, 2007 11:30 AM
xml invalid top level from ASP write XML(solution) g000we XML 0 August 9th, 2006 03:56 AM
Write XML element into textbox with XSLT tcstom XSLT 4 July 5th, 2006 04:08 AM
XML Write to a string dkb XML 0 December 16th, 2003 12:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.