xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Testing for presence of node


Subject: Re: [xsl] Testing for presence of node
From: "Dhruvraj Singh" <sdhruv@xxxxxxxxxxxxx>
Date: Fri, 21 Jun 2002 19:35:16 +0530

For each category element if you want to check for 
subcategory as its children, you can do :

<xsl:for-each select="//category">

        <xsl:if test="string-length(./*[name()=subcategory]) >0 )
           Success
        </xsl:if> 

        <xsl:if test="string-length(./*[name()=subcategory])=0 )
           Failure
        </xsl:if> 

</xsl:for-each>

> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have an XML file that contains the following structure:
> 
> <category>
>   <subcategory>
>     <article>
>     </article>
>   </subcategory>
> </category>
> 
> In my XSLT stylesheet, I need to be able to test if the <category>
> node I'm working with contains a <subcategory> node. What's the best
> way to test for the presence of this node without actually doing
> anything with it? I was thinking <xsl:if test="something">.
> 
> - -joeljkp
> 
> - ---------------------------------------
> http://www.ballsome.com 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
> 
> iQA/AwUBPRKA7H880CLOJa2eEQJxpwCg6XhYuz/DsUThGatqbkDa99G85XAAoL8b
> GrkEiFZTOBoCy9EHV1HxOiTA
> =ASvZ
> -----END PGP SIGNATURE-----
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor