xsl-list
[Top] [All Lists]

Re: [xsl] How to move processing instruction?

2007-04-16 03:03:45
OK!!! Please check the below and sorry for the inconvenience!!


XSL
<xsl:template match="processing-instruction('page')" mode="move">
<xsl:processing-instruction name="page"><xsl:value-of select="."/></xsl:processing-instruction>
</xsl:template>
<xsl:template match="div">
<div>
<xsl:attribute name="type">
<xsl:choose>
<xsl:when test="@type='part'">part</xsl:when>
<xsl:otherwise>chapter</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="preceding-sibling::processing-instruction('page')">
<xsl:apply-templates select="preceding-sibling::processing-instruction('page')[following-sibling::div[1][(_at_)id = current()/@id]]" mode="move" />
</xsl:if>
</div>
</xsl:template>

INPUT
<publication>
<?page 1?>
<?page 2?>
<pub-div type="body" id="C1">
<div type="chapter" id="C2">
...
</div>
<?page 3?>
<?page 4?>
<div type="chapter" id="C3">
...
</div>
</pub-div>
</publication>


OUTPUT
<body>
<div type="chapter"/>
<div type="chapter">
<?page 3?>
<?page 4?>
</div>
</body>


REQUIRED OUTPUT
<body>
<div type="chapter">
<?page 1?>
<?page 2?>
</div>
<div type="chapter">
<?page 3?>
<?page 4?>
</div>
</body>


At 11:47 AM 4/16/2007 +0200, you wrote:
J. S. Rawat wrote:
Please you check your input and cross-check it with my INPUT as shown below


At 12:29 PM 4/16/2007 +0300, you wrote:
Double checked...


It is clear that the code you posted or even both the code and your input file are different in your test than what you posted...

JS, you are not making it easy to help. Please post a minimized working sample of XSLT, input / output. I too was looking at your problem, but since in/out was not the same data you used for testing your XSLT, we can't help you further. Don't ask for re-check etc, instead provide us with more insight in your problem. We like to help, but we can't create solutions of thin air.

-- Abel

--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--