Re: [xsl] Replacing Attributes

Subject: Re: [xsl] Replacing Attributes
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Thu, 4 Apr 2002 04:47:44 -0800
I think you guys are misreading(?) what the person is asking.

To me the person was offering an example of something he thought we might be
familiar with us and asked us for the way to do it in XSL.

So - you can use an XSL Transformation that is basically an *identity
transformation* on the file to be transformed into itself: Something like:

<xsl:output
   method="xml"
   omit-xml-declaration="yes"/>

<!-- params sent into the transformation -->
<xsl:param name="id"/>
<xsl:param name="first_name"/>
<xsl:param name="last_name"/>
<xsl:param name="email"/>
<xsl:param name="password"/>

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

<xsl:template match="user">
    <xsl:choose>
        <xsl:when test="not(@id=$id)">
            <xsl:copy>
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates/>
            </xsl:copy>
        </xsl:when>
        <xsl:otherwise>
            <user id="{$id}" first_name="{$first_name}"
last_name="{$last_name}" email="{$email}" password="{$password}"></user>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

hth,
-Rob


----- Original Message -----
From: "Julian Reschke" <julian.reschke@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 03, 2002 11:23 PM
Subject: RE: [xsl] Replacing Attributes


> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of stevenson
> > Sent: Thursday, April 04, 2002 8:33 AM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] Replacing Attributes
> >
> >
> > But how do you do xslt without xml and xml DOM Methods?
>
> "How" you do XSLT depends on your environment. It may be a browser, a
shell
> script, a DOM extension, a Java package.
>
> You asked a question about DOM, so this isn't an XSL question. You
probably
> can find what you're looking for in the DOM recommendation:
>
> http://www.w3.org/TR/DOM-Level-2-Core
>
>
>
> >
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
> > Sent: 03 April 2002 20:19
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: [xsl] Replacing Attributes
> >
> > > Just like the way we have replaceChild method to replace
> > > nodes, how can
> > > Attributes be replaced? Please assist
> >
> > You're off-topic. This list is about XSLT and XSL-FO, and there's
nothing
> > called replaceChild in XSLT (or, as far as I know, in XSL-FO).
> >



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread