J. S. Rawat wrote:
Is there any technique by which we can extract attribute (first
instance) and make it processing instructions and process the tag as well.
I don't know how much more complex your real-world problem is than the
simplified one that you posted, but with your example I find it hard to
justify anything more complex than something like this.
<!-- not tested -->
<xsl:template match="*">
<xsl:if
test="@pg and (not(preceding::*[(_at_)pg])
or @pg != preceding::*[(_at_)pg][1])">
<xsl:processing-instruction name="p">
<xsl:value-of select="@pg"/>
</xsl:processing-instruction>
</xsl:if>
<xsl:element name="{local-name()}1">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@pg"/>
This may be insufficient if page numbers don't strictly increase, or if
you need to break a text node in the middle (because it straddles a page).
--~------------------------------------------------------------------
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>
--~--