Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] checking sequential element

From: Wendell Piez <wapiez@------------.--->
To: xsl-list@-----.------------.---
Date: 12/31/2008 4:25:00 PM
Hi,

Personally, I'd put the test on the citau element itself:

<xsl:template match="citau">
   <xsl:if test="not(following-sibling::*[1]/self::delim)">
     <xsl:message>citau does not followed by delim</xsl:message>
   </xsl:if>
</xsl:template>

This has the following advantages:

* It expresses the requirement directly (a 'citau' must be followed 
by a 'delim')
     and therefore more legibly
* It is more robust (it doesn't matter where the citau is; it doesn't
     report a false positive if a 'citau' is not found; it doesn't fail
     to report if two are found and one has a 'delim')

As so often, the theoretical and the practical advantages reflect one another.

Cheers,
Wendell

At 02:29 AM 12/31/2008, it was written:
>I think, you should do
>
><xsl:template match="citref">
>   <xsl:if test="not(citaug/citau/following-sibling::*[1]/self::delim)">
>     <xsl:message>citau does not followed by delim</xsl:message>
>   </xsl:if>
></xsl:template>
>
>you were missing a 'not' and one missing level.
>
>On Wed, Dec 31, 2008 at 12:00 PM, Ganesh Babu N <nbabuganesh@g...> wrote:
> > Dear All,
> >
> > I want to test the presence of <delim/> tag after </citau> in the
> > below example. If it is missing the XSL should raise an error.
> >
> > <citref id="bib12">
> >  <citaug>
> >  <citau>
> >   <citsname>Ferri</citsname>
> >   <delim/>
> >   <citfnames>E</citfnames>
> >  </citau>
> >  <delim/>
> >  <cittext>(ed.).</cittext>
> > </citaug>
> >
> > I have tried the following code but i am not getting the required result.
> >
> > <xsl:template match="citref">
> >  <xsl:if test="citau/following-sibling::*[1]/self::delim">
> >  <xsl:message>citau does not followed by delim</xsl:message>
> >  </xsl:if>
> > </xsl:template>
> >
> > Please help me in getting the desired result.


======================================================================
Wendell Piez                            mailto:wapiez@m...
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
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@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent