![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XSLT check if null or empty [Thread Next] Re: XSLT check if null or emptyTo: 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/
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
