[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: how to get rid of tag names

Subject: RE: how to get rid of tag names
From: "Smirnov, Anatoliy" <anatoliy.smirnov@xxxxxxxxxxx>
Date: Mon, 5 May 2003 10:05:52 -0400
get rid of html tags
Andrew,

Sorry about the confusion.
The source XML file is

<html>
  <body>
    <h>Header1</h>
    <p> A </p>
    <dl>
      <dt> B </dt>
      <dt> C </dt>
    </dl>
    <h>Header2</h>
    <p> D </p>
    <dl>
      <dt>
        <dt> E </dt>
      </dt>
    </dl>
    <p> F </p>
  </body>
</html>

and the output I need is

<ROWSET>
  <ROW>
   <HEADER> Header1 </HEADER>
   <BODY> ABC </BODY>
  </ROW>
  <ROW>
   <HEADER> Header2 </HEADER>
   <BODY> DEF </BODY>
  </ROW>
<ROWSET>

My xsl:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="html/body">
  <ROWSET>
    <xsl:apply-templates/>
  </ROWSET>
</xsl:template> 
<xsl:template match="html/body/h">
 <ROW>
   <HEADER>
     <xsl:value-of select="."/>
   </HEADER>
   <BODY>
     <xsl:apply-templates
select="following-sibling::*[generate-id(following-sibling::html/body/h[1])=
generate-id(current()/following-sibling::html/body/h[1])]"/>
   </BODY>
 </ROW>
</xsl:template> 
</xsl:stylesheet> 

gives me wrong result(numbers for reference only):

1 <ROWSET>
2   <ROW>
3   <HEADER> Header1 </HEADER>
4    <BODY> ABC 
5      <ROW>
6        <HEADER> Header2 </HEADER>
7        <BODY> DEF </BODY> 
8      </ROW>
9      DEF
10  </BODY>
11  </ROW> 
12  ABC
13  <ROW>
14    <HEADER> Header2 </HEADER>
15    <BODY> DEF </BODY>
16  </ROW>
17  DEF
18 <ROWSET>

I don't need lines 5-9,12,17.
I guess lines 12,17 are coming from the first template invocation
(match="html/body")
but without the first template I won't have top-level element <ROWSET> ? 
And I don't see why lines 5-9 are output?


Thank you.
Anatoliy Smirnov

-----Original Message-----
From: Andrew Watt [mailto:andrew@xxxxxxxxxxxxxx]
Sent: Friday, May 02, 2003 4:00 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  how to get rid of tag names


At 13:41 01/05/2003 -0400, you wrote:
>Sorry,I put abridged version of my source file in my question. The diff is
>that I have multiple tags under BODY node, I need all of them for every <h>
>node until the next <h> node:

Anatoliy,

The source XML you provided when you first asked your question and the 
source in your follow-up questions (part off list) have different 
structures, including different element names. I am not clear precisely 
what structure you are wanting to transform.

Please provide the relevant XML source that you want to transform and the 
desired output from that XML source. Then, hopefully, one of us can help 
you find a solution.

Andrew Watt



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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.