Re: Newbie Question

On May 6, 2008, at 6:16 PM, Frank Merrow wrote:

>
> I'm trying to learn XLS myself with limited success.
>
> So this is my input record:
>
> <AI00010002 type='wiki'>Status_Message_for_APS_MobModel_and_QXDM</ 
> AI00010002>
>
> and this is what I want for an output record:
>
> <aitag type="wiki">Status_Message_for_APS_MobModel_and_QXDM</aitag>
>
> I'm almost there . . . what goes in the place I am missing?
>
> <aitag><xsl:attribute name="type">what goes here?</ 
> xsl:attribute><xsl:value-of select="."/></aitag>


Well, you could use

	<aitag>
		<xsl:attribute name="type" select="@type"/>

which is shorthand for

	<aitag>
		<xsl:attribute name="type" select="attribute::type"/>

Or you could do it like this:

	<aitag>
		<xsl:copy-of select="@type"/>

Less verbose is this:

	<aitag type="{@type}">		<!-- using attribute value template -->

Alternatively, you can generalize it like this

	<aitag>
		<xsl:copy-of select="@*"/>	<!-- copy all attributes from context  
node -->


cheers, HTH
—ml—

Received on Wednesday, 7 May 2008 13:42:26 UTC