Is it possible to set the default value with <xsl:value-of> ? I am trying to create JSON output with an XSLT stylesheet, and some fields may not be available at processing time. This leaves a null value that violates the validity of the JSON document. Ideally, I could set a default if it is not available. So, in the case of:
"foo_count": <xsl:value-of select="count(foo)" />
If <foo> not available in the document, can I somehow set this to 0?
xml xslt
randombits
source share