Subject: Re: [xsl] RE: Using document() and XPath to extract data from multiple name spaces in multiple files From: Armen Martirossian <armmarti@xxxxxxxxx> Date: Thu, 14 Aug 2003 22:41:57 -0700 (PDT) |
--- "SORENS,MICHAEL (HP-Boise,ex1)" <michael.sorens@xxxxxx> wrote: > I received two identical suggestions to solve this > issue--and they fix > it--but I am still scratching the little mental > block up there on the top of > my head... > . > The suggestion was to change this: > > <xsl:template match="/files"> > <cc:myDoc > xmlns:cc="stuff.com" > xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > . . . > > To this: > <xsl:template match="/files"> > <cc:myDoc > xmlns:cc="stuff.com" > xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > . . . > > That is, adding an explicit namespace identifier for > the xhtml namespace, > then using the "xhtml:" prefix to access the nodes. > But since I already have > the xhtml namespace above as the default namespace > (xmlns="..."), why > doesn't an unadorned node name go into that > namespace already? > All elements in the xslt document without a prefix are in the default namespace in your xslt document(unless you suppressed it by another default-namespace-declaration in any element), but declaring the default namespace in the *xslt document* doesn't mean that all NodeTests which doesn't contain any prefix in XPath expressions must be automatically resolved: that is, when you write select="cc:element1/cc:element2/foo" the processor will get the node foo (according to this path) which is in the default namespace declared *in the source XML document*, and not in the default namespace you declared in the xslt document. That's why you must explicitly declare the namespace in the xslt document(the prefix is not important, it can be "abcdefgh", but the associated URI must be the same as in the source XML, i.e. "http://www.w3.org/1999/xhtml"), then refer to the element xslt:foo in the XPath expression. Regards, Armen __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] RE: Using document() and , Michael Kay | Thread | [xsl] jd.xsltc translet performs Sy, Burghard Güther |
Re: [xsl] document() function can't, Mukul Gandhi | Date | Re: [xsl] Walking the tree, Marcus Andersson |
Month |