xsl-list
[Top] [All Lists]

[xsl] Omit TEIForm and capture attributes of current node

2008-09-25 01:31:11
Hi
I want to omit TEIForm by xslt and want to capture attribute of <p>. Please let me know what is wrong in below xsl.

XSL
<xsl:template match="p">
<xsl:for-each-group select="node()" group-adjacent="self::list self::figure[(_at_)id]">
<xsl:choose>
<xsl:when test="current-grouping-key()">                        
<xsl:apply-templates select="self::*"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="@rend">
<p class="{(_at_)rend}">
<xsl:copy-of select="current-group()"/>
</p>
</xsl:if>
<xsl:if test="not(@rend)">
<p><xsl:copy-of select="current-group()"/></p>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:template>

INPUT
<p rend="right">Existing evidence <abbr type="acronym">WM</abbr> was the most... First <name>Federal Congress</name>. With the exception of his work.
<figure entity="F001" id="fig1"><figDesc>...</figDesc></figure>
He may have written others as well.</p>
<p align="left">dkdkdk</p>
<p>dkdk</p>

XSLT OUTPUT
<p>Existing evidence <abbr type="acronym" TEIform="abbr">WM</abbr> was the most... First <name TEIform="name">Federal Congress</name>. With the exception of his work. </p>
<div class="figure" id="F001">
  <a href="/images/fig1.jpg">
 <img src="/images/fig1.jpg" alt=""/>
</a>
<div class="caption">
<p>...</p>
</div>
</div>
<p>He may have written others as well.</p>
<p>dkdkdk</p>
<p>dkdk</p>

REQUIRED OUTPUT
<p class="right">Existing evidence <abbr type="acronym" TEIform="abbr">WM</abbr> was the most... First <name TEIform="name">Federal Congress</name>. With the exception of his work. </p>
<div class="figure" id="F001">
  <a href="/images/fig1.jpg">
 <img src="/images/fig1.jpg" alt=""/>
</a>
<div class="caption">
<p>...</p>
</div>
</div>
<p class="right">He may have written others as well.</p>
<p align="left">dkdkdk</p>
<p>dkdk</p>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>