Re: [xsl] Re: Conditional XSL Variable

Subject: Re: [xsl] Re: Conditional XSL Variable
From: raulvk <raulvk.soa@xxxxxxxxx>
Date: Thu, 20 Nov 2008 22:28:31 +0000
Wow, many thanks to everyone for their quick answers!

My intention was to select the entire map:entry node and assign it to
the variable. That would allow me to freely take the values of
$mappingsCodeA/@codeB  and  $mappingsCodeA/@codeC  later in the
stylesheet without having to create specific values for each.

I now understand the difference between using the "select" attribute
of xsl:variable and using xsl:value-of in the content of the variable.
So many thanks!

I think I will use David's solution: <xsl:variable
name="mappingsCodeA" select="$lookupTable/map:table/
(map:entry[@codeA=$valueOfCodeA],/map:otherwise)[1]"/>   although I
don't actually understands how it works right now, but I will research
it tomorrow!

Just one thing... while doing my own research, I came across some
sites that mentioned that as of XPath 2.0, one can use "if"
conditionals in XPath expressions. However, when trying to use it in
oXygen, the IDE didn't offer auto-completion because it didn't
recognise "if" as a legal XPath expression, even though I had
specified version="2.0" on my xsl:stylesheet declaration...

I thought that perhaps it is not possible to use XPath "if"
expressions inside XSLT 2.0 (since XSLT provides its own mechanisms
for conditionals), but it might as well just be a bug of the IDE...
Any thoughts on this?

Thanks a lot once again!!

2008/11/20 Andrew Welch <andrew.j.welch@xxxxxxxxx>:
>> You should also try putting <xsl:message><value-of
>> select="$valueofCodeA"/></xsl:message> in for debugging purposes in
>> case $valueofCodeA is different than what you expected.
> For debugging I really recommend checking out oXygen - it's great...
> You get 3 panes: input, stylesheet, result.  You can run the transform
> and then click on nodes in the result tree and get taken to the points
> in the stylesheet and input that created that node.  So if you get
> some unfamiliar xml and xslt, you can run it through the debugger and
> then click around the result to see how it was constructed.
> I don't know if that's a standard feature in all IDEs but it really is
> pretty amazing when you're use to "xsl:message debugging" :)  and well
> worth mentioning here.
> It also does all the other usual debugging stuff but this feature
> really is a killer feature... If anyone uses any of the other IDEs I'd
> be interested to know if they did the same.
> --
> Andrew Welch
> Kernow:

Current Thread