Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Parsing an XML file with namespace [Thread Next] Re: Parsing an XML file with namespaceTo: NULL Date: 9/22/2008 8:51:00 PM Steve wrote: > On Sep 22, 12:49 am, Peter Flynn <peter.n...@m.silmaril.ie> wrote: > >> Actually it doesn't. It starts like this: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" >> xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> >> <gesmes:subject>Reference rates</gesmes:subject> >> >> The root element shows the namespaces, so that you can instruct your >> processor that gesmes equates to "http://www.gesmes.org/xml/2002-08-01" >> and that the default namespace (used for all element types that do not >> have a prefix) is "http://www.ecb.int/vocabulary/2002-08-01/eurofxref" >> >> ///Peter > > Thank you Peter, could you have a little more patience with me and > explain how I can instruct my processor that gesmes equates to > "http://www.gesmes.org/xml/2002-08-01" and that the default namespace > (used for all element types that do not have a prefix) is "http:// > www.ecb.int/vocabulary/2002-08-01/eurofxref" You haven't told us what processor you're using, nor what language you're doing this work in. I just wrote the following XSLT to test it: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns:curr="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <title>Euros to Dollars</title> </head> <body> <p> <xsl:text>Today the Euro is worth </xsl:text> <xsl:apply-templates select="gesmes:Envelope/curr:Cube/curr:Cube /curr:Cube[@currency='USD']/@rate"/> <xsl:text> US Dollars</xsl:text> </p> </body> </html> </xsl:template> </xsl:stylesheet> You can see this execute in Cocoon at http://publish.ucc.ie/feeds/currency ///Peter | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
