Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Newbie to XML & XSL - problems selecting element values in XSL

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 11/6/2007 9:09:00 AM

"Rob W" <Whllrob@a...> wrote in message 
news:uwp1v4$HIHA.1184@T......
> Greetings,
>
> Im having alot of difficulties trying to select the value of an element 
> from my XML file to XSL file.
>
> Im trying to select the value of element <DeliveryNoteNo> into my XSL file 
> output, Xpath matches the path but does not select the value of 
> <DeliveryNoteNo> i.e it prints from the line <strong>Deliver Note No: 
> </strong> but cannot select the value of my:DeliveryNoteNo.
>
> Does anybody have any ideas?
> Perhaps I need to look back at my schema too?
>
> See xml and xsl files below.
>
> Xml file extract.
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- edited with XMLSpy v2007 (http://www.altova.com) by Rob (EMBRACE) -->
> <PODBatch xmlns="http://my-pod/namespace" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="http://my-pod/namespace 
> E:\DOCUME~1\Rob\Desktop\POD02.XSD">
> <POD>
> <DeliveryInfo>
> <DeliveryNoteNo>DN012345</DeliveryNoteNo>
> <DeliveryDateTime>01/11/07 10:35</DeliveryDateTime>
> <DeliveryDrivername>Bill Egg</DeliveryDrivername>
> <DeliveryDriverSignature>B.Egg</DeliveryDriverSignature>
> <DeliveryStatus>In transit</DeliveryStatus>
> </DeliveryInfo>
> </POD>
> </PODBatch>
>
>
> Here is my full XSL file:-
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsi ="http://www.w3.org/2000/10/XMLSchema-instance"
> xmlns:my="http://my-pod/namespace">
> <xsl:template match="/">
> <html>
> <Header>
> <img 
> src="http://i140.photobucket.com/albums/r13/robtyketto/truck-clipart-icon2_ys61.gif" 
> align="left"/>
> <h2>Proof-of-Delivery</h2>
> <xsl:apply-templates select="//my:POD/my:DeliveryInfo"/>
> <br></br>
> <hr></hr>
> </Header>
> <body>
> <h3>Sender:</h3>
> <address>
> Company<br />
> </address>
> </body>
> </html>
> </xsl:template>
> <xsl:template match="my:POD/my:DeliveryInfo">
> <strong>Deliver Note No: </strong>
> <xsl:value-of select="my:DeliveryNoteNo"/>
> </xsl:template>
> </xsl:stylesheet>
>
> Thanks
> Rob W
>
Can't see anything obviously wrong and works for me using 
XslCompiledTransform in .NET and Saxon 8.9.


-- 

Joe Fawcett (MVP - XML)
http://joe.fawcett.name




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent