Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSLT check if null or empty

From: "Robin van de Water [synthesiSFactory]" <robin@--.-->
To: NULL
Date: 7/3/2006 12:11:00 PM

Thank you very much for your help!

This did the trick for me.


"Martin Honnen" <mahotrash@y...> wrote in message 
news:uNqXiBEnGHA.5056@T......
>
>
> Robin van de Water [synthesiSFactory] wrote:
>
>
>> <Batch>
>> <Job>
>> <CBCity>Poole</CBCity>
>> <CBState>CA</CBState>
>> </Job>
>> <Job>
>> <CBCity>Amsterdam</CBCity>
>> <CBState></CBState>
>> </Job>
>> </Batch>
>>
>> I want to turn this into the following format:
>>
>> <Batch>
>> <Job>
>> <Field name="CBCity" value="Poole" />
>> <Field name="CBState" value="CA" />
>> </Job>
>> <Job>
>> <Field name="CBCity" value="Amsterdam" />
>> </Job>
>> </Batch>
>>
>> As you can see, I want to have an output that leaves out the CBState 
>> field if it is empty or null.
>
>   <xsl:template match="CBState[node()]">
>     <Field name="{name()}" value="{.}" />
>   </xsl:template>
>
>   <xsl:template match="CBState[not(node())]" />
>
> Then simply make sure that you process CBState elements as children of the 
> Job element with an appropriate xsl:apply-templates.
>
>
>
> -- 
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/ 




transparent
Print
Mail
Digg
delicious
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