xsl-list
[Top] [All Lists]

Re: dynamic variable name/implementation question

2005-08-25 12:09:41





Hi,

          If you don't know the name of the node to which you would like to
apply your template use some wildcards.

<xsl:template match="*">

or <xsl:template match="node()">


and then you can do

<xsl:if test="local-name() = $param">
<xsl:value-of select="@parameter"/>
</xsl:if>

inside the template.

Hope this helps.

cheers,
prakash



                                                                                
                                                         
                      Ed S                                                      
                                                         
                      <lists(_at_)highpeaksso         To:      
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
                
                      ftware.com>                cc:      (bcc: 
omprakash.v/Polaris)                                                     
                                                 Subject: [xsl] dynamic 
variable name/implementation question                            
                      08/25/2005 11:47                                          
                                                         
                      PM                                                        
                                                         
                      Please respond to                                         
                                                         
                      xsl-list                                                  
                                                         
                                                                                
                                                         
                                                                                
                                                         




Hi-
I'm trying to find a workaround or alternate implementation for a
particular problem I'm tring to solve.  I have various parameters that
are passed into the processor, and I would like to use their values in
the stylesheet.  However, I've found that XSLT 1.0 does not support
dynamic variables.
I would like to do the following:

XML:
...
<text-block>
   this is some text. Folowing is dynamic- <external-value
parameter="someParam"/> -preceding was dynamic
</text-block>
...

XSL:
...
<xsl:template match="external-vaue">
    <xsl:value-of select="$(_at_)parameter"/> <!-- this won't work -->
</xsl:template>
...

where there is a parameter "someParam" passed into the stylesheet - say
someParam="foo".  My output would be:
...
 this is some text. Folowing is dynamic- foo -preceding was dynamic
...

Has anybody else ever needed this fuctionality?



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to 
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its 
attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--