|
Subject: [xsl] grouping children of same name parents under one common tag From: abickford@xxxxxxxxxx Date: Thu, 19 Jun 2003 15:13:25 -0400 (EDT) |
Good afternoon. I'm new to xsl, and need some advice on how to format a
document. I'm looking to find all the tags with the same name, collect
their children and put them all under one common tag. Part of the problem
is, I have no idea what the tag names will be.
Let's say the xml I want to transform looks like this:
<root>
<bob>
<someTag>content1</someTag>
</bob>
<bob>
<someTag>content2</someTag>
</bob>
<sue>
<someTag>content3</someTag>
</sue>
<warren>
<someTag>content4</someTag>
</warren>
<warren>
<someTag>content5</someTag>
</warren>
</root>
I would like the output to be:
<root>
<bob>
<someTag>content1</someTag>
<someTag>content2</someTag>
</bob>
<sue>
<someTag>content3</someTag>
</sue>
<warren>
<someTag>content4</someTag>
<someTag>content5</someTag>
</warren>
</root>
Again, I don't know the tag names ahead of time(Bob, Sue, and Warren are
just examples). I'm not sure how to tell xsl that I want to:
1) compare the current node's name with its siblings' names.
2) if a name match is found, adopt the matched sibling's children. (matched
sibling can die now, how nice of me ;)
3) keep looking for more siblings with matching names, adopting their
children if more matches are found.
4) don't repeat steps 1-3 for matched siblings (not an issue if they were
killed in step 2 when their children were taken away).
Thanks for any help. I'm having trouble accomplishing this, even tho I
know exactly what I want.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Global, dynamically-named, Mark Miller | Thread | RE: [xsl] grouping children of same, Lars Huttar |
| [xsl] GetParameter from XSL, Claudio Russo | Date | RE: [xsl] number + document, Lars Huttar |
| Month |