|
Subject: Re: [xsl] Copy missing elements From: andrew welch <andrew.j.welch@xxxxxxxxx> Date: Tue, 6 Sep 2005 13:15:43 +0100 |
On 9/6/05, Rick Quatro <frameexpert@xxxxxxxxxxxx> wrote:
> I have the basic structure.
>
> <list>
> <member>
> <lastname>Jones</lastname>
> <firstname>Frank</firstname>
> <email>frank@xxxxxxxxx</email>
> </member>
> <member>
> <lastname>Smith</lastname>
> <firstname>John</firstname>
> </member>
> </list>
>
> The second <member> does not have an <email> element. I want to duplicate
> the structure, but add an empty <email> element to the new xml document, so
> it looks like this:
>
> <list>
> <member>
> <lastname>Jones</lastname>
> <firstname>Frank</firstname>
> <email>frank@xxxxxxxxx</email>
> </member>
> <member>
> <lastname>Smith</lastname>
> <firstname>John</firstname>
> <email></email>
> </member>
> </list>
If your structure really is just like that, then the simplest way is:
<xsl:template match="member">
<member>
<lastname><xsl:value-of select="lastname"/></lastname>
<firstname><xsl:value-of select="firstname"/></firstname>
<email><xsl:value-of select="email"/></email>
</member>
</xsl:template>
cheers
andrew
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Copy missing elements, Rick Quatro | Thread | Re: [xsl] Copy missing elements, Mukul Gandhi |
| [xsl] Copy missing elements, Rick Quatro | Date | Re: [xsl] Excluding text fragments, andrew welch |
| Month |