This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: (consistency in select results?) converting attributes to nested tags recursively
- From: Edward dot Middleton at nikonoa dot net
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 8 Feb 2002 11:48:46 +0900
- Subject: RE: [xsl] (consistency in select results?) converting attributes to nested tags recursively
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thanks for your help this is mostly what I was looking for but I was hoping to do it in a way that used
Template matches for the nodes for the following reasons.
1. I want to be able to override the way the tag is created for particular attributes, but also have
a default behavior for others.
i.e. I might want to produce
<attrib1 value="fds">
rather then
<tag name="attrib1" value="fds/>
2. The attrib2 could also be on TagB and in this case would have the same behavior
i.e.
<tagA attribreq="attribreqvalue1" attrib1="fds" attrib2="hdg">
<TagB attrib2="hdg">Text1</TagB>
<tagA attribreq="attribreqvalue1" attrib1="fds" attrib2="hdg" />
</tagA>
would produce
<attribreq attrib="attribreqvalue1">
<tag name="attrib1" value="fds">
<tag name="attrib2" value="hdg">
<TagB>
<tag name="attrib2" value="hdg">Text1</tag>
</TagB>
</tag>
</tag>
</attribreq>
<attribreq attrib="attribreqvalue1">
<tag name="attrib1" value="fds">
<tag name="attrib2" value="hdg"/>
</tag>
</attribreq>
>Hmm... OK, one thing that you should be aware of is that attribute
>order is not retained in an XPath node tree. So the fact that attrib1
>comes before attrib2 in the tagA start tag in your example doesn't
>mean that the attrib1 attribute node comes before the attrib2
>attribute node in the XPath node tree. I'll assume that you don't care
>about the ordering in which the tag elements are nested inside each
>other, as it makes things simpler.
I understand this but for consecutive matches will the order be the same. i.e. if
@* produces @c @a @b will it always produce @c @a @b or can the
search order change.
If this is the case I could create a sequence in each match template to determine if it was the last
attribute.
Thanks again for you help.
Edward
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list