Re: [xsl] First Element Event

Subject: Re: [xsl] First Element Event
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Thu, 08 Sep 2005 09:09:34 +0200
Hi,
Tempore 01:12:17, die 09/08/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Pape, Nathan S. <Nathan.Pape@xxxxxxx>:


Basically my source document contains a group of two or more aliases, as in the element named: <OTHER_NAME> , and I just need to move them to the result tree under only one element

Try the following templates:


<xsl:template match="/">
	<xsl:element name="abcxyz:transaction">
		<xsl:element name="abcxyz:record">
			<xsl:attribute name="type"><xsl:value-of select="2"/></xsl:attribute>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:element>
</xsl:template>

<xsl:template name="process_record" match="OTHER_NAME[1]">
	<xsl:element name="abcxyz:field">
		<xsl:attribute name="name">
			<xsl:value-of select="'T2_AKA'"/>
		</xsl:attribute>
		<xsl:attribute name="number">
			<xsl:value-of select="19"/>
		</xsl:attribute>
		<xsl:apply-templates select="../OTHER_NAME" mode="group_aliases"/>
	</xsl:element>
</xsl:template>

<xsl:template match="OTHER_NAME[position()!=1]"/>

<xsl:template match="OTHER_NAME/*" mode="group_aliases">
	<xsl:element name="abcxyz:subfield">
		<xsl:element name="abcxyz:item">
			<xsl:value-of select="."/>
		</xsl:element>
	</xsl:element>
</xsl:template>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant

Current Thread