XSLT help building a mail selector

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

XSLT help building a mail selector

James Newcombe
I'm having a problem working this out, partly because I'm not even sure of the terminology for what I'm looking for. In my mulptiple email filter, I've modified the apps/fr/i18n/resource.xml file to add email bodies, so for each language I have a structure something like : <body/> <body/> .. .. .. <body/</approved> The form has a hidden field that determines the current state of the form (submitted, validated, approved, etc). I use the content of that field in email-form.xpl to select which email body I need to use, so form state = 'validated', I pick $fr-resources/resource[@xml:lang = $request-language]/email/validated/body It's not graceful, but it works. What I'd like to do, to reduce the amount of code, is to instead code it as $fr-resources/resource[@xml:lang = $request-language]/email/$formstate/body so that I don't need a big set of xsl:when statements. I'm nothing close to an XSLT expert, and for reasons I don't understand, $fr-resources in the path above results in the value of fr-resources being inserted into the path, but $formstate doesn't. Any suggestions would be welcome..
Reply | Threaded
Open this post in threaded view
|

Re: XSLT help building a mail selector

Alessandro  Vernet
Administrator
Hi James,

Assuming $formstate is 'validated' and you'd like to get the equivalent of $fr-resources/resource[@xml:lang = $request-language]/email/validated/body, then in XPath you need to write $fr-resources/resource[@xml:lang = $request-language]/email/*[local-name() = $formstate]/body.

As you might have already guessed, * matches all the elements, but you add a predicate say "such as the local name is $formstate".

You'll let us know if this works for you!

Alex

On Wed, Mar 18, 2015 at 4:27 PM James Newcombe <[hidden email]> wrote:
I'm having a problem working this out, partly because I'm not even sure of the terminology for what I'm looking for. In my mulptiple email filter, I've modified the apps/fr/i18n/resource.xml file to add email bodies, so for each language I have a structure something like : <body/> <body/> .. .. .. <body/</approved> The form has a hidden field that determines the current state of the form (submitted, validated, approved, etc). I use the content of that field in email-form.xpl to select which email body I need to use, so form state = 'validated', I pick $fr-resources/resource[@xml:lang = $request-language]/email/validated/body It's not graceful, but it works. What I'd like to do, to reduce the amount of code, is to instead code it as $fr-resources/resource[@xml:lang = $request-language]/email/$formstate/body so that I don't need a big set of xsl:when statements. I'm nothing close to an XSLT expert, and for reasons I don't understand, $fr-resources in the path above results in the value of fr-resources being inserted into the path, but $formstate doesn't. Any suggestions would be welcome..

View this message in context: XSLT help building a mail selector
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet