[xsl] How to strip out a pair of <p> tag from xml data before putting out on an html page using XSL?

Subject: [xsl] How to strip out a pair of <p> tag from xml data before putting out on an html page using XSL?
From: "Govil, Anoop (Contractor)" <Anoop.Govil@xxxxxxxxxxxxxxxx>
Date: Tue, 3 Feb 2004 09:43:34 -0500

I have an interesting problem. I am implementing a FAQ page which lists set
of question and answer and has an index of question on the top (pretty
standard FAQ page). Now, when the data for question and answer is input
through a template, there is a pair of <p> tags around the answer which
throws the content of answer to next line when transformed through XSL. I
will appreciate if someone out there could suggest how I can strip out this
extra pair of p tag befor putting out the content on html (through XSL). My
problem is that the data element that contains <p> tags will also contain
other html formatted text in it like ordered list, etc. as follows:

<p> some data here... </p><p>ordered list here:</p><ul><li><p>Bullet

Now what I need to strip out is the first <p> tag pair so that when I align
the answer (A.) with its content, the content doesn't fall to next line due
to the <p> tag. like shown here:

Q. Question 1?

some data here...

ordered list here:

Here is my XML and XSL that I implemented. Any help on fixing this will be
much appreciated. Thanks in advance.


<?xml version="1.0"?>
	<Page_Text>Some Text paragraph here.</Page_Text>
		<Question>Question 1?</Question>
		<Answer><p>Answer 1</p></Answer>
		<Question>Question 2?</Question>
		<Answer><p>Answer 2</p></Answer>
		<Question>Question 3?</Question>
		Answer 3.
		Descriptive Text:
		Bullet 1.
		Bullet 2.
	<Content_Owner />
	<Content_Owner_Email />
	<Keywords />


<?xml version="1.0"?>
<xsl:stylesheet version="1.1"
	<xsl:output method="html" />

	<xsl:template match="/">
			<!-- beging list of questions -->
href="#{generate-id(Question)}"><span id="questionlist"><strong><xsl:copy-of
select="./Question" /></strong></span></a></td></tr>
			<!-- end list of questions -->

			<!-- begin FAQ question -->

			<xsl:if test="normalize-space(PAGE/FAQs)">
				<xsl:for-each select="PAGE/FAQs">
	    			<a name="#{generate-id(Question)}">
	    			<span id="question">
					<strong>Q. <xsl:value-of
select="./Question" /></strong></span></a><br />
					<!-- begin Answer part -->
					<strong>A. </strong><xsl:copy-of
select="./Answer" />
					<!-- end Answer part -->

			<!-- end FAQ question -->


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

Current Thread