|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Group and filter with XSL
Hi, I'm trying to transform a XML document in another XML document. The transformation is basicaly a copying the input XML but I have to identify and group an especific group of elements. Does somebody know if is possible to use XSL for that and how? An Example: the input XML has a DTD similar to this: ---begin DTD <!ELEMENT c (c*)> <!ATTLIST c ext CDATA #REQUIRED form CDATA #IMPLIED > <!ELEMENT p (s*)> <!ATTLIST p id ID #REQUIRED > <!ELEMENT s (c*)> <!ATTLIST s id ID #REQUIRED > <!ELEMENT data (p+)> ---end DTD So the problem is that I have to group all elements "c" with attributes ext="tag" and form="n" that have one element "c" with attributes ext="tag" and form="n" among them at the same level of the XML tree. An Example of XML input: ----begin xml <data> <p id="p_1"> <s id="s_1"> <c ext="root" form="fcl"> <c ext="tag" form="n"> <c ext="n" form="att"/> <c ext="h" form="n"/> </c> <c ext="tag" form="n"> <c ext="n" form="att"/> <c ext="h" form="n"/> </c> <c ext="flag" form="c"/> <c ext="tag" form="n"> <c ext="n" form="att"/> <c ext="h" form="n"/> </c> <c ext="p" form="v"> <c ext="aux" form="v_fin"/> <c ext="mv" form="v_pcp"/> </c> <c ext="pv" form="p"> <c ext="h" form="pp"/> <c ext="p" form="n"> <c ext="n" form="att"/> <c ext="h" form="n"/> </c> </c> </c> </s> </p> </data> ----end xml The expected result XML (the changes are marked with <------): ----begin result <data> <p id="p_1"> <s id="s_1"> <c ext="root" form="fcl"> <group> <------ <c ext="tag" form="n"> <------ <c ext="n" form="att"/> <------ <c ext="h" form="n"/> <------ </c> <------ <c ext="tag" form="n"> <------ <c ext="n" form="att"/> <------ <c ext="h" form="n"/> <------ </c> <------ <c ext="flag" form="c"/> <------ <c ext="tag" form="n"> <------ <c ext="n" form="att"/> <------ <c ext="h" form="n"/> <------ </c> <------ </group> <------ <c ext="p" form="v"> <c ext="aux" form="v_fin"/> <c ext="mv" form="v_pcp"/> </c> <c ext="pv" form="p"> <c ext="h" form="pp"/> <c ext="p" form="n"> <c ext="n" form="att"/> <c ext="h" form="n"/> </c> </c> </c> </s> </p> </data> ----end result I'm new to XSL, so I'm a little lost with it. I've tryed to write a solution but I don't have enought knowledge to do that :-( Your help will be very much appreciated. Thanks a lot, Roger. __________________________________________________________________________ Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - I gratis! http://antipopup.uol.com.br/
|
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
|

Cart








