RE: [xsl] two namespaces and a position problem

Subject: RE: [xsl] two namespaces and a position problem
From: "Hansen, John" <John.Hansen@xxxxxxxxxx>
Date: Thu, 13 May 2004 09:17:36 -0700
/xml/s:Schema would work but you don't need to nest your XML root
element inside an <xml> element.

-----Original Message-----
From: April Fleming [mailto:AFleming@xxxxxxxxxxxx] 
Sent: Thursday, May 13, 2004 11:05 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: RE: [xsl] two namespaces and a position problem


Strange thing is ... Schema is the top element under the <xml> element,
however if I remove the // or replace it with /s:Schema it does not
work.
That is why I used the //.  Not sure of an alternative.

Not sure if it is because this code is inside of 

<xsl:template match="rs:data">

and the Schema is in s namespace at top of xml doc.

Example xml

<xml ...>
	<s:Schema ..>
		<s:ElementType...>
			<s:AttributeType..>
			...
		</s:ElementType>
	</s:Schema>

	<rs:data>
		<z:row...>
			....
		</z:row>
	</rs:data>
</xml>

April Fleming

Information Services

Dixon Ticonderoga Company

407-829-9000 ext. 153


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx] 
Sent: Thursday, May 13, 2004 12:03 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] two namespaces and a position problem


> please let me know if you see anything else wrong
since you asked:-)

<xsl:for-each
select="//s:Schema/s:ElementType/s:AttributeType">

Beware // there which means search the whole document,  You may know
that s:Schema is always at the top, but XSLT doesn't and will search the
entire document looking for all the s:Schema elements it can find.

It's probably right at the top in which case you want / not //
but even if you have some wrappers round the Schema element it is worth
having a more explict xpath /x/y/z/s:Schema.

David

-- 
The LaTeX Companion
  http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996
 
http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0
6198
04


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread