Re: [xsl] xpath problem

Subject: Re: [xsl] xpath problem
From: Raffaele Sena <raff@xxxxxxxxxxxx>
Date: Sat, 23 Oct 2004 20:19:41 -0700
Try to precede the element names in your query with *: (i.e
//*:Document, *:Information, *:Title)
(and I am never sure if you have to do it for attributes to).

If you want to use the real namespace, assuming you are working with
XSLT, you add the namespace declarations in the stylesheet tag (add
xmlns:site="http://limpens.com/site";), then you can add the namespace
to the query elements
(//site:Document, etc.)

Also, start with a simple query so that you can make sure it works, and
then work your way to the final query.

Hope this helps,

Raffaele


On Saturday, October 23, 2004, at 06:36 PM, Jan Limpens wrote:


Raffaele,

how do I use a namespace in a query?

--Jan


On Fri, 22 Oct 2004 19:06:58 -0700, Raffaele Sena <raff@xxxxxxxxxxxx> wrote:
Probably because the document uses a namespace but your query doesn't.

-- Raffaele



-----Original Message-----
From: Jan Limpens [mailto:jan.limpens@xxxxxxxxx]
Sent: Friday, October 22, 2004 6:40 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] xpath problem

hi folks,

can anypne tell me why this query
//Document[@href='Publications.aspx']/Information[lang('de')]/Title

yields no results on this document

<?xml version="1.0" encoding="utf-8"?>
<Site xmlns="http://limpens.com/site";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://limpens.com/site Schemas/Site.xsd">
        <RootDocument href="Default.aspx">
                <Information lang="de">
                        <Title>Startseite</Title>
                        <Description>Limpens.com
Homepage</Description>
                </Information>
                <Information lang="pt">
                        <Title>Inicial</Title>
                        <Description>Limpens.com
Homepage</Description>
                </Information>
                <Information lang="en">
                        <Title>Home</Title>
                        <Description>Limpens.com
Homepage</Description>
                </Information>
                <Document href="Illustrations.aspx">
                        <Information lang="de">
                                <Title>Illustrationen</Title>
                                <Description>Portfolio kommerzieller
Arbeiten</Description>
                        </Information>
                        <Information lang="pt">
                                <Title>Ilustragues</Title>
                                <Description>Portfolio de trabalhos
comerciais</Description>
                        </Information>
                        <Information lang="en">
                                <Title>Illustrations</Title>
                                <Description>Portfolio illustrations
and
grafic design</Description>
                        </Information>
                </Document>
                <Document href="Publications.aspx">
                        <Information lang="de">
                                <Title>Vervffentlichungen</Title>
                                <Description>Otakoo Saloon Cartoon und
mehr...</Description>
                        </Information>
                        <Information lang="pt">
                                <Title>Publicagues</Title>
                                <Description>Otakoo Saloon Cartoon e
mais</Description>
                        </Information>
                        <Information lang="en">
                                <Title>Publications</Title>
                                <Description>Otakoo Saloon Cartoon
Comic
Strip and related
stuff</Description>
                        </Information>
                        <Document href="OtakooSaloonCartoon.aspx">
                                <Information lang="de">
                                        <Title>Otakoo Saloon
Cartoon</Title>
                                        <Description>\ber den
beliebten
Comicstrip</Description>
                                </Information>
                                <Information lang="pt">
                                        <Title>Otakoo Saloon
Cartoon</Title>
                                        <Description>A tira
famosa</Description>
                                </Information>
                                <Information lang="en">
                                        <Title>Otakoo Saloon
Cartoon</Title>
                                        <Description>The famous comic
strip</Description>
                                </Information>
                                <Document href="SecretOSC.aspx">
                                        <Information lang="de">
                                                <Title>Otakoo Saloon
Cartoon
Preview (Password)</Title>
                                                <Description>Vorschau
und
Archiv</Description>
                                        </Information>
                                        <Information lang="pt">
                                                <Title>Otakoo Saloon
Cartoon
Pre-Estreia</Title>
                                                <Description>Pre
Estreia
(requer senha)</Description>
                                        </Information>
                                </Document>
                        </Document>
                </Document>
                <Document href="Development.aspx">
                        <Information lang="de">
                                <Title>Entwicklung</Title>
                                <Description>Diverse Projekte in c#,
xml,
xsd, xslt und anderen
Abk|rzungen</Description>
                        </Information>
                        <Information lang="pt">
                                <Title>Desenvolvimento</Title>
                                <Description>Diversos aventuras em
c#, xml,
xsd, xslt e outras
abreviagues</Description>
                        </Information>
                        <Information lang="en">
                                <Title>Development</Title>
                                <Description>Diverse adventures in
c#, xml,
xsd, xslt und other
fancy abreviations</Description>
                        </Information>
                </Document>
                <Document href="Contact.aspx">
                        <Information lang="de">
                                <Title>Kontakt</Title>
                                <Description>Wie man mich am besten
erreicht</Description>
                        </Information>
                        <Information lang="pt">
                                <Title>Contato</Title>
                                <Description>Oi</Description>
                        </Information>
                        <Information lang="en">
                                <Title>Contact</Title>
                                <Description>Reach me
here</Description>
                        </Information>
                </Document>
        </RootDocument>
</Site>

and what I should make different...?

thanks for the help!

--
Jan
http://www.limpens.com

Otakoo Saloon Cartoon - newest episode at
http://limpens.com/oscredirect




--
Jan
http://www.limpens.com

Otakoo Saloon Cartoon - newest episode at
http://limpens.com/oscredirect



!DSPAM:417afea1291821541918357!

Current Thread