xsl-list
[Top] [All Lists]

Re: can restructure xml??

2003-01-15 09:34:53
You want something like

<xsl:template match="title">
<item>
  <xsl:copy-of select=". |
         following-sibling::writer[1] |
         following-sibling::type[1] |
         following-sibling::remark[1]"/>
</item>
</xsl:template>

Michael Kay
         

From: "a847356549/mail.h7.dion.ne.jp" 
<motom(_at_)h7(_dot_)dion(_dot_)ne(_dot_)jp>
Date: 2003/01/15 Wed AM 11:32:02 GMT
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] can restructure xml??

hello.
I just started putting my data into xml.
now I only have a xml like ---

<root>
  <list>
    <title>aaa</title>
    <writer>bbb</writer>
    <type>ccc</type>
    <remark>ddd</remark>
    <title>eee</title>
    <writer>fff</writer>
    <type>ggg</type>
    <remark>hhh</remark>
    ...
  </cd>
</list>

my ideal structure is like ---

<root>
  <list>
   <item num="1">
    <title>aaa</title>
    <writer>bbb</writer>
    <type>ccc</type>
    <remark>ddd</remark>
   </item>
   <item num="2">
    <title>eee</title>
    <writer>fff</writer>
    <type>ggg</type>
    <remark>hhh</remark>
   </item>
    ...
  </list>
</root>

is there a way to do this throgh xsl?  any advice and hint will
 be grateful. 

ttkaya

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




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



<Prev in Thread] Current Thread [Next in Thread>