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 October 6th, 2009, 07:31 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Return LineNumber Attribute value

xslt 1.0

Hi,

I am having problems returning the LineNumber value (01) as a varible from the following code example.


Code:
<?xml version="1.0" encoding="UTF-8"?>
<F4FInvoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.first4farming.com/F4FXML/...1_0/F4FInv.xsd" InvoiceType="Invoice" DocumentType="New" TypeOfSupply="Sale">
 <F4FDocumentHeader>
 ...
 </F4FDocumentHeader>
 <InvoiceHeader>
 ...
 </InvoiceHeader>
 <TransportDetails>
 ...
 </TransportDetails>
 <InvoiceLine>
   <LineReference ReferenceType="Order Number" AssignedBy="Supplier" LineNumber="01">0025450251</LineReference>
 </InvoiceLine>
 <TaxTrailer TaxCode="Z" TaxPercentage="0" Currency="GBP">
 ...
 </TaxTrailer>
 <InvoiceControlTotals>
 ...
 </InvoiceControlTotals>
</F4FInvoice>
I have tried several methods, but can't remember the correct technique. Both of the following are returning the '0025450251' value.

Code:
<xsl:variable name="SOURCE" select=".//InvoiceLine/LineReference[@ReferenceType='Order Number'][@AssignedBy='Supplier'][@LineNumber]"/>
Or

Code:
<xsl:variable name="SOURCE" select=".//InvoiceLine/LineReference[@LineNumber]"/>
Can anyone help please?

Thanks in advance,
__________________
Neal

A Northern Soul
 
Old October 6th, 2009, 07:36 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You need to put the @LineNumber as the last step in your path:
Code:
//InvoiceLine/LineReference[@ReferenceType='Order Number'][@AssignedBy='Supplier']/@LineNumber
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
Neal (October 6th, 2009)
 
Old October 6th, 2009, 07:41 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Thanks for the very prompt reply. I knew it was something simple,
__________________
Neal

A Northern Soul





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
attribute Eddy de Boer XSLT 5 June 16th, 2006 07:12 AM
all attribute kfir XML 1 May 8th, 2006 09:34 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
return tree untill attribute is true jdiderik XSLT 4 May 3rd, 2005 09:42 AM





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