[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: sub element selection
At 11:16 AM 4/16/2002, Jeni wrote:
Hi Pete,
you can just use . to mean "the value of the current node":
[snip example]
you could use xsl:choose instead:
[snip alternate]
The easiest way to get hold of that is to go up to the Communication
element and then down again to the CommunicationNumber element:
This gives:
[snip merged example]
In this case it makes more sense to me to match the Communication elements
and refer to the CommunicationType and CommunicationNumber children as follows:
[snip another alternate]
And since you're doing roughly the same for each of them, I'd be
tempted to put the xsl:choose within the xsl:with-param rather than
having two separate calls, although on the other hand this does assume
that the CommunicationType is either 'DAYPHONE' or 'EMAIL', which
might not be a valid assumption:
[snip single all-encompassing template]
In your 'makeProperty' template, it would also probably be simpler if
you used attribute value templates rather than xsl:attribute:
[snip attribute example]
Or of course you could do the whole thing in one template if you
wanted:
[snip tiny template]
In XSLT 2.0, even simpler:
[snip smallest yet]
Jeni
Or you can just use XSLT 4.2 and type:
<b9/>
Goodness Jeni, never let it be said that you give half-assed
answers. We all appreciate it. :)
Greg Faron
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|