Subject: RE: [xsl] how to get rid of tag names From: "Smirnov, Anatoliy" <anatoliy.smirnov@xxxxxxxxxxx> Date: Mon, 5 May 2003 10:05:52 -0400 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] how to get rid of tag nam, Andrew Watt | Thread | RE: [xsl] how to get rid of tag nam, Sundar Shanmugasunda |
[xsl] New XSLT 2.0 Working Drafts, Andrew Watt | Date | RE: RE: [xsl] Numbered Elements, cknell |
Month |