Subject: [xsl] [XSL] Problem with selecting nodes From: "Etheridge, Stephen" <stephen.etheridge@xxxxxxxxxx> Date: Thu, 2 Sep 2010 16:02:26 +0100 |
I have a source XML file of the structure: <MIS_Report> <Records> <XXXRecord> <XXXRecordDetails> <XXXRecordHeader/> <XXXRecordVersion/> </XXXRecordDetails> </XXXRecord> </Records> </MIS_Report> There are multiple XXXRecords in <Records> and XXXRecordVersion contains a number of descendant elements. I am transforming the source via an XSLT (using Xalan). I have a problem. The output should look like <RecordBatch> <BatchHeader/> <RecordMessage> <MessageHeader/> <RecordHeader/> <Record> </RecordMessage> </RecordBatch> With there being multiple RecordMessages, one for each XXXRecordVersion in the source. The relevant bit of XSLT is: <xsl:template match = "/MIS_Report/Records/XXXRecord/XXXRecordDetails/XXXRecordVersion"> Some XSLT that seems to work ..... <RecordHeader> More XSLT that seems to work </RecordHeader> <xsl:apply-templates select="//RecordVersion" mode="Copy" /> </RecordMessage> </xsl:template> <xsl:template match="*" mode="copy"> XSLT that seems to work </xsl:template> The issue is that the </RecordMessage> tag is never reached. My output looks like <RecordBatch> <BatchHeader/> <RecordMessage> <MessageHeader/> <RecordHeader/> <Record> <MessageHeader/> <RecordHeader/> <Record> <MessageHeader/> <RecordHeader/> <Record>etc </RecordMessage> </RecordBatch> i.e. I end up with a RecordMessage of 38 records, instead of 38 RecordMessages! I have done something very silly, but I cannot see what. Any help would be gratefully received. Stephen Etheridge | Managing Consultant, Information Management, Business Optimisation Team 250 Brook Drive, Green Park, Reading RG2 6UA | United Kingdom M: +44 7796 336 567 stephen.etheridge@xxxxxxxxxx | www.logica.com Registered in England & Wales (registered number 947968) Registered Office: 250 Brook Drive, Green Park, Reading RG2 6UA, United Kingdom Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu sch|tzen. / Por favor ajude a Logica a respeitar o ambiente nao imprimindo este correio electronico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Creating exception in pro, Michael Kay | Thread | Re: [xsl] [XSL] Problem with select, Martin Honnen |
Re: [xsl] exsl:node-set issue in Xa, Satish | Date | [xsl] Selecting lots of nodes with , Fabien Tillier |
Month |