Subject: RE: [xsl] element with namespace From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Mon, 30 Sep 2002 20:58:56 +0100 |
To match an element <x xmlns="default.namespace.uri"/> use: <xsl:zzzzz select="prefix:x" xmlns:prefix="default.namespace.uri"/> You need to match both the namespace and the local name, and the only way to match a namespaced element in XPath is with a QName that has an explicit prefix. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Venkateshwar Bommineni > Sent: 30 September 2002 16:39 > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] element with namespace > > > Hi all, > I am having a problem while trying to match root element > which has namespace declaration. here is the test snippet i > am trying .. > > > Input XML is: > ------------------------------------------------------- > <?xml version="1.0"?> > <Test xmlns="http://www.foo.com/namespace/v1" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.foo.com/namespace/v1 > C:\schema\definition.xsd"> > <People> > <Person> > <FName>fname1</FName> > <LName>lname1</LName> > </Person> > <Person> > <FName>fname3</FName> > <LName>lname3</LName> > </Person> > </People> > </Test> > > > > Input XSL is: > --------------------------------------------------------------- > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:template match="/"> > <Members> > <xsl:apply-templates select="Test/People"/> > </Members> > </xsl:template> > > <xsl:template match="People"> > <xsl:for-each select="Person"> > <Member><xsl:value-of > select="concat(substring(LName,1,1),'.',FName)"/></Member> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > > Output of above transformation results: > --------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <Members/> > > > And if remove the namespace declaration from my input xml it > works fine. > > So is that namespace declaration not allowed or is there any > magic property i need to set in XSL to ignore namespace declarations? > > thanks in advance > Venkat > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] element with namespace, Venkateshwar Bommine | Thread | RE: [xsl] element with namespace, Venkateshwar Bommine |
RE: [xsl] replace function, Michael Kay | Date | Re: [xsl] replace function, Kurt Cagle |
Month |