[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] stripping <p> tags from a block of HTML
hello all-- I am writing an XSL stylesheet that will be used to convert a large collection of identically-formatted existing XML documents to HTML. The XML source includes both well-formed XML elements as well as one particular node (called <DataContent>) that is a block of HTML in its own right. Right now, I'm using a very simple sequence to dump the block over: <xsl:template match="DataContent"> <html> <xsl:copy-of select="node()"/> </html> This works okay, but since the block of HTML is full of <p> and </p> tags, this creates too much space between the lines for my purposes. I would like to strip the <p> tags out completely and replace the </p> tags with <br> tags. I tried using template match="p" and then implimenting the translate*command but I couldn't get the parser to drill into the "DataContent" node. Is there a quick and easy way to replace tags within an existing block of HTML? Alternatively, should I be converting the whole block to XML before trying to replace anything? Technical details: I am using the MSXML engine in Cooktop; the source files are in XML version 1.0. Here's the source: <DataContent> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title/> </head> <body> <p>1. KYLE MINOGUE WELCOMING THE SCISSOR SISTERS ONTO STAGE</p> <p>2. VARIOUS SHOTS OF THE SCISSOR SISTERS PLAYING LIVE IN CONCERT IN TRAFALGAR SQUARE</p> <p>VARIOUS UNIDENTIFIED MUSIC VIDEO LOCATIONS (FILE) (MUST COURTESY UNIVERSAL MUSIC INTERNATIONAL - NO WIRELESS OR ARCHIVE USE) </p> <p>3. SCISSOR SISTERS MUSIC VIDEO CLIP 'I DON'T FEEL LIKE DANCIN' </p> <p>STORY: Just under 4000 music fans got the opportunity to see the Scissor Sisters play a live free gig at London's Trafalgar Square on Saturday (September 16). </p> <p>The concert was organised in conjunction with U2 front man Bono's sponsored charity campaign, The Global Fund as part of (RED) in an attempt to raise awareness fo the plight of HIV Aids sufferers in Africa.</p> <p>It was pop princess Kyle Minogue who got the concert off to its start at the famous London site. The National Portrait Gallery providing the backdrop for the main stage. </p> <p>The New York act played one of their biggest individual gigs in the UK to date giving their fans at the concert the opportunity to sample the bands latest material from their new album 'Ta-Dah', which is set to be released in the UK on September 18th. The Sissor Sisters also played 'I Don't Feel Like Dancin', which is their first ever UK number one hit. The song looks set to stay at the top of the UK charts for a second week in a row.</p> <p>The Scissor Sisters began their fairytale success story as a little-known support act, and have ended up as a global pop phenomenon. Their highly successful debut album, which spawned a further four hits (Take Your Mama, Mary, Laura and Filthy/Gorgeous), was the biggest-selling album last year, and has now sold over 2.4 million copies in Britain alone. </p> <p>Motorola is a partner of (RED), the initiative co-founded by Bono and Bobby Shriver, with the launch of the original red MOTOSLVR handset on May 15th 2006. Motorola and the retailer partners in the UK are contributing 10 British sterling from every red MOTOSLVR handset purchased to the Global Fund. </p> </body> </html> </DataContent> Thanks, Pascal Pinck __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|