RE: [xsl] Finding a String and adding a line

Subject: RE: [xsl] Finding a String and adding a line
From: <rick.fraser@xxxxxx>
Date: Thu, 12 May 2005 15:48:07 +0100
Thanks for the help - I have used part of the advice and solved the
problem. Works in Xray and in actual Application. It was MUCH MUCH
easier using Xray.

There were indeed child nodes to get around. Using the original XML, I
now have this XSLT code which does exactly what I needed to do....

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:template match="BT_CONTRACT_PERSON_SYNC">
<BT_CONTRACT_PERSON_SYNC>

<!-- remove this...   <xsl:copy-of select="FieldTypes"/> and add... -->
   <FieldTypes>
         <xsl:apply-templates select="FieldTypes"/>
   </FieldTypes>
<!-- end of inserted code -->
   <MsgData>
      <!-- Transaction -->
         <xsl:apply-templates select="MsgData/Transaction"/>
      <!-- /Transaction -->
   </MsgData>
</BT_CONTRACT_PERSON_SYNC>
</xsl:template>

<!-- main added code - -->

<xsl:template match="FieldTypes">
         <xsl:apply-templates select='BT_PROV_SYNC[@class="R"]'/>
         <xsl:copy-of select='SPB_PERSON_TBL[@class="R"]'/>
</xsl:template>

<xsl:template match='BT_PROV_SYNC[@class="R"]'>
   <xsl:copy>
      <xsl:attribute name="class"> <xsl:value-of select="@class"/>
</xsl:attribute>
      <xsl:apply-templates select="node()"/>
   </xsl:copy>
</xsl:template>

<xsl:template match='BUSINESS_UNIT[@type="CHAR"]'>
     <BUSINESS_UNIT type="CHAR"/>
     <COMPANY type="CHAR"/>
</xsl:template>

<!-- end of main added code -->

<xsl:template match="MsgData/Transaction">
<Transaction>
         <xsl:apply-templates select="BT_PROV_SYNC"/>
         <xsl:copy-of select="SPB_PERSON_TBL"/>
</Transaction>
</xsl:template>

<xsl:template match="BT_PROV_SYNC">
   <xsl:copy>
      <xsl:attribute name="class"> <xsl:value-of select="@class"/>
</xsl:attribute>
      <xsl:apply-templates select="node()"/>
   </xsl:copy>
</xsl:template>

other transformation code goes in here

<!-- copy other fields -->
<xsl:template match="*">
   <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

Basically, I had to replace the 'bulk' copy of "FieldTypes" with some
template transformations (main added code).

Thanks again for the start hint "[@" Prakash and Michael

Regards,
Rick

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: 12 May 2005 12:41
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Finding a String and adding a line


me> does that cut down version generate the error? (It looks OK to me)

but Michael looked harder...
(still odd to get an EOF error from that though....)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread