[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Name Spaces in Selects and xsl:element

Subject: Re: Name Spaces in Selects and xsl:element
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Thu, 5 May 2005 09:03:14 -0700
xsl fn namespace
> omit-result-prefixes="ms"
Did you mean exclude-result-prefixes?

exclude-result-prefixes is working, except for variables/elements that
are being evaluated with xxx:nod-set().  I have a template rule which
sorts data, and creates a number attribute from a date, the result
might look something like this:

<fn:members>
  <fn:member>
      <field name="first_name">Suzie</field>
      <field name="dob" num_dtm="19990604"/>1999-06-04</field>
  </fn:member>
  <fn:member>
      <field name="first_name">Bob</field>
      <field name="dob" num_dtm="20010304"/>2001-03-04</field>
  </fn:member>
</fn:members>

Contained in the variable "sorted_members".  The xml result of this is
not as "pretty" as I'd like it, all though better for sure; it removed
my other namespaces, but the xmlns definition for "fn" lingers.

Any ideas on that?

On 5/5/05, David Carlisle <davidc@xxxxxxxxx> wrote:
>
> > So, given the sample data, how would one
> > select all elements who's namespace is "fn"?
>
> select="//fn:*"
>
> does just what you say 9so long as fn prefix is bound to a namespace in
> your stylesheet (the source doesn't have to use the same prefix)
>
> But that probably isn't what you want to do, as selecting all elements
> in a single node set isn't usually useful. In this case you'd get fn:A
> and all the fn:B's
>
> if you justuse a normal apply-templates then you can make all elements
> be discarded
> <xsl:template match="*"/>
> and then have more specific templates to do something with fn elements,
> eg
> <xsl:template match="fn:*">
> <xsl:apply-templates/>
> </xsl:template>
>
> will produce the result that you wanted.
>
>  Another question, about xsl:element.  When I use this to create
>  elements, the elements never get the appended xmlns attribute added.
>
> note that namespace declarations (xmlns....) are not attributes to
> XPath/XSLT (even though they use a similar syntax)
>
>
> > <NewElement xmlns:ms="urn:schemas-microsoft-com:xslt">
> > How can this be avoided without using the xsl:element command?
>
> Th ms namespace prefix must be in scope in your stylesheet.
> If you need it declared but don't need it in the result add
> omit-result-prefixes="ms"
> to your xsl:stylesheet element.
>
> David
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.