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

Re: using default params?

Subject: Re: using default params?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 29 Mar 2000 16:19:30 GMT
Re: using default params?
> David,
> very nice explanation of xsl:copy-of

hmm but it obviously didn't have the intended effect of explaining
the code:-)

> But could you explain further how the code you present would set a default
> value for the attribute?
> 
> > 
> > <table border="1001" >
> >   <xsl:copy-of select="@border"/>

(I corrected a typo in my original: it had ! instead of ", which 
is easily done if typing on a UK keyboard with your eyes closed,
and a duplicated word border which was added by a cosmic ray after I
posted the message)


<table border="1001" >

makes a n element node with name table
and one attribute node with name border

<xsl:copy-of select="@border"/>

either does nothing, in which case you get what you have above
or it generates an attribute node with name border.
XSLT specifies that if you add two attribute nodes of the same name to
an element the first one is discarded. So in this case  the original
attribute node with value 1001 is replaced by the border attribute
copy-of'ed from the source tree.

So effectively you get a copy of the original except that you get a
default value of 1001 in the case when there was no border attribute
originally.

David


 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.