This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Design question


Much, much thanks to Peter, Antonio, Jeni, and Michael for the replies. You've given me plenty to work with. I should have things working this morning.

It's too bad all technical lists don't work as well as this one. Thanks again.

Jay

> -----Original Message-----
> From: Jay Burgess [mailto:jburgess@digarch.com]
> Sent: Tuesday, July 09, 2002 5:13 PM
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] Design question
>
>
> I'm attempting to use XSL to transform XML to XML. The
> problem is that
> some child elements in the original XML are "attributes" of
> the new XML
> element, whereas other child "elements" are actually new
> child elements.
> That is:
>
> BEFORE:
> <test type="positive" name="Test 1">
> <param name="p1">123</param>
> <param name="date1">July 9</param>
> <param name="p2">false</param>
> </test>
>
> AFTER:
> <da:Positive name="Test 1" p1="123" p2="false">
> <da:Date number="1" value="July 9"/>
> </da:Positive>
>
> (Notice that p1 and p2 become attributes of the new element,
> but date1
> becomes a new child element.)
>
> From what I can tell, I need to accomplish the equivalent of the
> following, but haven't been able to come up with the way to do it:
>
> (1) Iterate through all original <param>s. For each <param> that will
> become an attribute, do <xsl:attribute>. For each <param>
> that will become
> a child element, store it off to the side in a node set of some sort.
>
> (2) When the iteration is complete, iterate through the node
> set built in
> (1), and do <xsl:element> on each.
>
> Is this the right way to solve this problem? If so, can
> someone provide
> some more detail, as nothing I've tried has worked. Or, is
> there a better way?
>
> Thanks in advance.
>
> Jay
>
> -- Jay Burgess [jburgess@digarch.com]
> Digital Archaeology Corporation
> (913) 438-9444 x154
>


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]