[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Extract attribute and make processing instructions
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::*[@pg]) or @pg != preceding::*[@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).
|
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
|