xsl-list
[Top] [All Lists]

Re: [xsl] XML transformation based on parameters

2009-04-14 13:11:31
Thanks Sam! I needed your XSLT1.0 version...

e.

2009/4/14 Sam Byland <shbyland(_at_)verizon(_dot_)net>:
Emiliano,

if you're limited to XSLT1, then try matching on "param" and place the code
associated with "@name = $p" in the template body.  Something like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

 <xsl:param name="p" select="id"/>
 <xsl:param name="v" select="newvalue"/>

 <xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="param">

  <xsl:choose>
    <xsl:when test="@name = $p">
      <xsl:value-of select="$v"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="."/>
    </xsl:otherwise>
  </xsl:choose>

 </xsl:template>

</xsl:stylesheet>

...sam

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--