[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: Thu, 1 May 2003 13:41:41 -0400
get rid of tags
Sundar,
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:
<html>
  <body>
    <h>header1</h>
    <p>p line</p>
    <d>d line</d>

    <h>header2</h>
    <a>a line</a>
    <b>b line</b>
    ...
  </body>
</html>
Thus my xsl with following-sibling expression.
With Sundar's version I will only have the first sibling after <h> for every
<h> node.
I found this template on XSL-list that gives nodes between two nodes with
the same name (200008/msg01102) 

<xsl:template match="tag"
<group>
   <xsl:copy-of select="
       following-sibling::*[generate-id(following-sibling::tag[1])=
	generate-id(current()/following-sibling::tag[1])]"/>
</group>
</xsl:template>

But I don't know how to put it to work the right way. My xsl

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

gives me the output 

<?xml version = '1.0'?>
<ROWSET>
  <ROW>
   <HEADER>header1</HEADER>
   <BODY>p line</BODY>
  </ROW>
</ROWSET>
p line
d line
<ROWSET>
  <ROW>
   <HEADER>header2</HEADER>
   <BODY>a line</BODY>
  </ROW>
</ROWSET>
a line
b line

instead of what I want:

<?xml version = '1.0'?>
<ROWSET>
 <ROW>
  <HEADER>header1</HEADER>
  <BODY>
    p line
    d line
  </BODY>
 </ROW>
 <ROW>
  <HEADER>header2</HEADER>
  <BODY>
    a line
    b line
  </BODY>
 </ROW>
</ROWSET>    

Thank you.
Anatoliy Smirnov
Oracle Mid-Atlantic Consulting


-----Original Message-----
From: Sundar Shanmugasundaram [mailto:SSHANMUGASUNDARAM@xxxxxxxxxxxxx]
Sent: Thursday, May 01, 2003 11:05 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  how to get rid of tag names


USe this xsl

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

sundar

-----Original Message-----
From: Smirnov, Anatoliy [mailto:anatoliy.smirnov@xxxxxxxxxxx]
Sent: Thursday, May 01, 2003 8:32 PM
To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Subject:  how to get rid of tag names


Hello,
Sorry for such a dumb question but I am new here.

I need to get rid of tag names <p> and </p> in the result document.

<?xml version = '1.0'?>
<ROWSET>
  <ROW>
    <HEADER>
	header
    </HEADER>
    <BODY>
       <p>p line</p>
    </BODY>
  </ROW>
</ROWSET>

so instead of
       <p>p line</p>
I just need to have
       p line

I am getting this from this source

<html>
  <body>
    <h>header</h>
    <p>p line</p>
  </body>
</html>

running this xsl

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

Thank you.
Anatoliy Smirnov

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

 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.