.... but you can't in XSLT, so I wondered whether it's possible to get XSLT to assign the variable value based on the first non-empty item? e.g.
<xsl:variable name="mediaId" select="number( coalesce( data [@alias='carouselImage'], data [@alias='thumbnail'] ) )" />
if only that function exists! OK, so now I'm thinking I need to create a separate macro... does anyone know of a better way to do this? I could just rename the aliases in both doc types to be the same, however, that could cause a conflict.
MS T-SQL Coalesce XSLT equivalent
Hi there, I have an XSLT macro which I need to adapt so that it can also retrieve data from another doc type, and output virtually the same xhtml.
So I would like to do this
.... but you can't in XSLT, so I wondered whether it's possible to get XSLT to assign the variable value based on the first non-empty item? e.g.
if only that function exists! OK, so now I'm thinking I need to create a separate macro... does anyone know of a better way to do this? I could just rename the aliases in both doc types to be the same, however, that could cause a conflict.
thanks
Kris
Hi Kristan
you can make the content of the variable conditional
Hey Kris,
I just wondered why you can't have 2 macros, one for each doctype?
Jay
Hi Kris,
you can use a xsl:choose perhaphs:
HTH,
Peter
Hi guys - this is great, I didn't realise you could nest a choose inside a variable element.
I could make two macros, but they are so similar - so it'll probably be a bit easier to just maintain one.
thanks again
k
is working on a reply...