span tags in html to html conversion
Posted: Thu Dec 22, 2011 2:51 am
Hello,
I can't figure out how to do this. I have an html generated from a document that I need to transform to another html doc. Everything is working great except when it comes to <span> tags inside of <p> tags. I need to transform:
into this
Also I am using xsl:choose and xsl:when for all <p> tags.
my transform snippet looks like this:
and
Any ideas?
I can't figure out how to do this. I have an html generated from a document that I need to transform to another html doc. Everything is working great except when it comes to <span> tags inside of <p> tags. I need to transform:
Code: Select all
<p><span class="x-first-para">Think that new opportunities, advancement within your own organization, and a bigger number for your next comp package are in your future? Not so fast.</span> Though you may be confident of your skills and past performance, you may be the only one. Be warned: In this rocky economic landscape, those responsible for assessing and valuing C-suite talent are assessing candidates with fresh eyes.</p>
Code: Select all
<p><span class="article_runin">Think that new opportunities, advancement within your own organization, and a bigger number for your next comp package are in your future? Not so fast.</span> Though you may be confident of your skills and past performance, you may be the only one. Be warned: In this rocky economic landscape, those responsible for assessing and valuing C-suite talent are assessing candidates with fresh eyes.</p>
my transform snippet looks like this:
Code: Select all
<xsl:template match="p">
<xsl:choose>
...
<xsl:when test="span[@class=x-first-para]">
<p><xsl:apply-templates/></p></xsl:when>
...
</xsl:choose></xsl:template>
Code: Select all
<xsl:template match="span">
<span class="article_subhead">
<xsl:if test="@class='x-first-para'"></xsl:if>
<xsl:value-of select="."/>
</span>
</xsl:template>