Subject: Re: using default params? From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 29 Mar 2000 16:19:30 GMT |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: using default params?, Francois Lachance | Thread | Re: using default params?, Jens Lautenbacher |
Re: Differences between Saxon, XT a, Steve Tinney | Date | Debugging Script in XSL, menkell |
Month |