Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / March 2008

Tip: Looking for answers? Try searching our database.

carrying xml name spaces across nested elements

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Datawich - 27 Mar 2008 08:00 GMT
Hi.  By persistence, I've discovered that when several nested elements
in a schema are each qualified by a namespace, I can successfully
reference them in a select statement by qualifying each element by its
namespace in succession.  For example, for a schema that qualfies each
element in a nested series "command, heading, pivot table" by "xs", I
can use an xpath statement like "//xs:command/xs:heading/
xs:pivotTable" to select the pivot table node.

I figure that when all the name space qualifications are identical,
there's some way to carry the namespace across all the elements
without typing exact same one for each separately.  Is there? If so,
could someone tell me what it is?

Thanks for any help!
Martin Honnen - 27 Mar 2008 13:20 GMT
> Hi.  By persistence, I've discovered that when several nested elements
> in a schema are each qualified by a namespace, I can successfully
[quoted text clipped - 8 lines]
> without typing exact same one for each separately.  Is there? If so,
> could someone tell me what it is?

With XSLT 2.0 and XPath 2.0 there is an XPath default namespace that you
can set e.g.
  <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0"
    xpath-default-namespace="http://example.com/2008/ns1">

  <xsl:template match="/">
    <xsl:value-of select="//command/heading/pivotTable"/>
so that way you don't need a prefix.

Is that what you have in mind, avoiding to type the prefix 'xs'?

XSLT and XPath 2.0 are not supported by Microsoft products but there are
third party implementations, Saxon from
<URL:http://saxon.sourceforge.net/> has a .NET and a Java version,
AltovaXML <URL:http://www.altova.com/altovaxml.html> is a COM solution,
Gestalt <URL:http://gestalt.sourceforge.net/> has binaries for different
platforms.

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.