|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Conditional variable assignment
The root node of my document has a style attribute which serves as the
default for the entire XML document. Nested subordinate elements MAY have an
attribute that overrides the document default as shown in the snipet below.
<root_element default_style="style1">
<child>
<grandchild style_override="style5"/>
</child>
</root>
As you might guess the logic of my XSLT says if the grandchild has an
override use its value otherwise use the default. Once I know which value
to use I need to construct an <xsl:choose> to know what to do next.
I created a top-level (global) variable to capture the default style so it
will be available when I instantiate the grand child node
<xsl:variable name="default_style" select="root_element/@default_style />
Now I THINK I would like to create ONE variable to use in the xsl:choose
construct.....BUT I can't quite get it right.
CONCEPTUALLY I want to say:
<xsl:variable name="style"
<xsl:if test="@style_override">
style = @style_override
</xsl:if>
<xsl:if test="not(@style_override)">
style =$default_style
</xsl:if>
<!-- Now with the variable "style" set -->
<xsl:choose>
<xsl:when text="$style=style1">
....call template1....
</xsl:when>
<xsl:when text="$style=style2">
....call template2....
</xsl:when>
Any help would be greatly appreciated....Thanks
"You already have zero privacy -- get over it !!
Melvyn Rosengarden
melrose@xxxxxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








