S
silver_sabrina
Hey everyone, I'm having some trouble with this. I need to convert one
xml doc into another and I think that XSLT may be the answer, so I'd
like some help from the gurus out here If XSLT cannot solve the
problem then I think I'll have to write a Java program using DOM or
something.
Here is an example of what I am trying to accomplish - basically, I
need to do a lookup on the author's first name and last name and then
create the nested XML structure containing book info by that author
Source XML:
<books>
<author>
<fname>William</fname>
<lname>Shakespeare</lame>
<bookName>Merchant of Venice</bookName>
<bookRank>One</bookRank>
</author>
<author>
<fname>William</fname>
<lname>Shakespeare</lame>
<bookName>As You Like It</bookName>
<bookRank>Two</bookRank>
</author>
</books>
Needs to be transformed to:
<books>
<author>
<fname>William</fname>
<lname>Shakespeare</lname>
<books>
<book>
<bookName>Merchant of Venice</bookName>
<bookRank>One</bookRank>
</book>
<book>
<bookName>As You Like It</bookName>
<bookRank>Two</bookRank>
</book>
</books>
</author>
</books>
I'm not an expert in XSL so don't know if this is even possible?
Thanks,
Sabrina
xml doc into another and I think that XSLT may be the answer, so I'd
like some help from the gurus out here If XSLT cannot solve the
problem then I think I'll have to write a Java program using DOM or
something.
Here is an example of what I am trying to accomplish - basically, I
need to do a lookup on the author's first name and last name and then
create the nested XML structure containing book info by that author
Source XML:
<books>
<author>
<fname>William</fname>
<lname>Shakespeare</lame>
<bookName>Merchant of Venice</bookName>
<bookRank>One</bookRank>
</author>
<author>
<fname>William</fname>
<lname>Shakespeare</lame>
<bookName>As You Like It</bookName>
<bookRank>Two</bookRank>
</author>
</books>
Needs to be transformed to:
<books>
<author>
<fname>William</fname>
<lname>Shakespeare</lname>
<books>
<book>
<bookName>Merchant of Venice</bookName>
<bookRank>One</bookRank>
</book>
<book>
<bookName>As You Like It</bookName>
<bookRank>Two</bookRank>
</book>
</books>
</author>
</books>
I'm not an expert in XSL so don't know if this is even possible?
Thanks,
Sabrina