This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Non-hierarchy XML -> hierarchy XML
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Non-hierarchy XML -> hierarchy XML
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Tue, 26 Jun 2001 14:09:50 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
I would tackle this by transforming your "pattern" document into an XSLT
stylesheet, and then applying the stylesheet to the original "source"
document.
Mike Kay
> I would like to transform a node into a hierarchy node
> using a pattern, i.e <node> into <AAA><BBB><CCC>.
>
> Assume the non-hierarchy source :
> <?xml version="1.0"?>
> <topic>
> <node1>I</node1>
> <node2>need</node2>
> <node3>your</node3>
> <node4>help</node4>
> <node5>please</node5>
> </topic>
>
> and the pattern as follows :
> <node1> : <AAA><BBB><CCC><DDD code="value">
> <node2> : <AAA><BBB><CCC><DDD>
> <node3> : <AAA><BBB><CCC><EEE>
> <node4> : <AAA><BBB><CCC><EEE><FFF><GGG>
> <node5> : <AAA><HHH>
>
> Applying that pattern against the above source, give this
> hierarchy result :
> <?xml version="1.0"?>
> <AAA>
> <BBB>
> <CCC>
> <DDD code="I">need</DDD>
> <EEE>your
> <FFF>
> <GGG>help</GGG>
> </FFF>
> </EEE>
> </CCC>
> </BBB>
> <HHH>please</HHH>
> </AAA>
>
> Any suggestion how can I achieve that transformation ?
>
> Thanks,
> Benoit Aumars.
>
>
>
> ************************************************************
> JLT Management Services Limited
> 6 Crutched Friars, London EC3N 2PH. Co Reg No 1536540
> Tel: (44) (0)20 7528 4000 Fax: (44) (0)20 7528 4500
> http://www.jltgroup.com
> ------------------------------------------------------------
> The content of this e-mail (including any attachments) as
> received may not be the same as sent. If you consider that
> the content is material to the formation or performance of
> a contract or you are otherwise relying upon its accuracy,
> you should consider requesting a copy be sent by facsimile
> or normal mail. The information in this e-mail is
> confidential and may be legally privileged. If you are not
> the intended recipient, please notify the sender immediately
> and then delete this e-mail entirely - you must not retain,
> copy, distribute or use this e-mail for any purpose or
> disclose any of its content to others.
>
> Opinions, conclusions and other information in this e-mail
> that do not relate to the official business of JLT
> Management Services Limited shall be understood as neither
> given nor endorsed by it. Please note we intercept and
> monitor incoming / outgoing e-mail and therefore you should
> neither expect nor intend any e-mail to be private in nature.
>
> We have checked this e-mail for viruses and other harmful
> components and believe but not guarantee it virus-free prior
> to leaving our computer system. However, you should satisfy
> yourself that it is free from harmful components, as we do
> not accept responsibility for any loss or damage it may
> cause to your computer systems.
> ************************************************************
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list