xsl-list
[Top] [All Lists]

Re: [xsl] generating xml from xslt

2008-08-26 10:59:40
Sarkup Sarkup wrote:

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


Define three global parameters
  <xsl:param name="a1"/>
  <xsl:param name="a2"/>
  <xsl:param name="a3"/>
so that you can provide values for the transformation then keep this template

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

remove the following template

<xsl:template match="/root/status/locn/loc1/address">
<xsl:element name="add1"></xsl:element>
<xsl:element name="add2"></xsl:element>
<xsl:element name="add3"></xsl:element>
</xsl:template>

and add three templates
  <xsl:template match="add1">
    <xsl:copy>
      <xsl:value-of select="$a1"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="add2">
    <xsl:copy>
      <xsl:value-of select="$a2"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="add3">
    <xsl:copy>
      <xsl:value-of select="$a3"/>
    </xsl:copy>
  </xsl:template>
--

        Martin Honnen
        http://JavaScript.FAQTs.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>
--~--

<Prev in Thread] Current Thread [Next in Thread>