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

Re: Multiple attributes present and non-present

Subject: Re: Multiple attributes present and non-present
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 04 Mar 2002 15:03:51 -0500
Re:  Multiple attributes present and non-present
Mike,

At 01:22 PM 3/4/2002, you wrote:
I was looking for a way to copy all the attributes of any element in
my xsl:stylesheet. I stumbled on to this (below).  I have not found
an example of copy-of being used this way. Should I use a different
method?

No, if you want to copy all attributes, this works fine.


Also it would be nice not to have the empty attributes (taken from my
dtd probably) appear. How can I null this consequence?

If you want to avoid attributes whose value is the null string, then do


<xsl:copy-of select="@*[string(.)]

which copies only those attributes whose string value tests as true (is non-null). If you want to eliminate also attributes that have only whitespace, do

<xsl:copy-of select="@*[normalize-space(.)]

Attributes which have a default in the DTD will still be copied. Unfortunately, the XSLT data model does not preserve information about whether an attribute value was provided by default.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.