Subject:xsl Attribute Author:P S Date:02 Dec 2005 01:32 PM
I am new to xslt stuff. I am trying to build an html file from xslt. I have bunch of hidden fields for html form whose value needs tobe populated based on two xml element. If first element is empty it should populate with other and vice versa. How do i create this rule?
Any help would be greatly appreciate.
Here is a sample line of what i am trying to do...
Subject:xsl Attribute Author:Minollo I. Date:02 Dec 2005 01:45 PM
I'm not sure I understand why you go through the invocation of a named template, but I would tend to think that what you wrote should work if you were not creating the two param* elements inside the template:
Doing that, you are preventing XSLT from generating the "value" attribute as a result of the xsl:attribute instruction. Using Saxon as your processor, you would receive an error like "XTDE0410: An attribute node (value) cannot be created after the children of the containing element".
Subject:xsl Attribute Author:P S Date:02 Dec 2005 01:56 PM
Thanks for your help. Your suggetion did work. As i said I am new to all this xslt stuff. Is there any other way to do this? I mean easier and faster? The other thing i noticed is it creates this
<xsl:otherwise xmlns:xsl="http://www.w3.org/1999/XSL/Transform" value=""></xsl:otherwise> Is it suppose do that?
Subject:xsl Attribute Author:Minollo I. Date:02 Dec 2005 02:09 PM
I missed that in your code. It's outputting <xsl:otherwise> because the <xsl:otherwise> instruction is mistakenly a child of the <xsl:when> element. It's supposed ot be a sibling of <xsl:when>. Running the XSLT inside the Saxon processor, you would get the error "XTSE0010: An xsl:when element must not contain an xsl:otherwise element".
About a "simpler way" to do that, as I mentioned I would just skip the call to the extra template: