[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Processing Instructions

Subject: RE: Processing Instructions
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Fri, 07 Dec 2007 17:13:42 +0530
RE:  Processing Instructions
Right Sir, you are right and always right!!!

At 11:35 AM 12/7/2007 +0000, you wrote:
I think you are under the false impression that the preceding axis includes
the parent of a node. Replace "preceding::*[1]" by
(preceding::*|ancestor::*)[last()]

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: J. S. Rawat [mailto:jrawat@xxxxxxxxxxxxxx]
> Sent: 07 December 2007 11:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Processing Instructions
>
> Hi everybody!!!
> Can anybody let me know about the mistake I am doing!!
>
>
> XSL
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="2.0"> <xsl:template match="*">
>    <xsl:if
>      test="@pg and (not(preceding::*[1]/@pg)
>        or @pg != preceding::*[1]/@pg)">
>      <xsl:processing-instruction name="p">
>        <xsl:value-of select="@pg"/>
>      </xsl:processing-instruction>
>    </xsl:if>
>    <xsl:element name="{local-name()}">
>      <xsl:apply-templates select="node()"/>
>    </xsl:element>
> </xsl:template>
> <xsl:template match="@pg"/>
> </xsl:stylesheet>
>
> Input
> <ch pg="1">
> <p pg="1">1</p>
> <p pg="1">2<s pg="1">3</s>4</p>
> <p pg="1">5</p>
> <p pg="1">6<s pg="2">7</s>8</p>
> <p pg="2">9</p>
> <p pg="2">10</p>
> <p pg="2">11</p>
> <p pg="2">12<m pg="3">13<s pg="3">14</s></m>15</p> </ch>
>
> XSLT Result
> <?p 1?><ch>
> <?p 1?><p>1</p>
> <p>2<s>3</s>4</p>
> <p>5</p>
> <p>6<?p 2?><s>7</s>8</p>
> <p>9</p>
> <p>10</p>
> <p>11</p>
> <p>12<?p 3?><m>13<?p 3?><s>14</s></m>15</p> </ch>
>
> Required Result
> <?p 1?><ch>
> <p>1</p>
> <p>2<s>3</s>4</p>
> <p>5</p>
> <p>6<?p 2?><s>7</s>8</p>
> <p>9</p>
> <p>10</p>
> <p>11</p>
> <p>12<?p 3?><m>13<s>14</s></m>15</p>
> </ch>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.