[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Finding a String and adding a line

Subject: RE: Finding a String and adding a line
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 12 May 2005 11:57:01 +0100
adding a line in xml
This isn't a valid match pattern:

<xsl:template match='BUSINESS_UNIT type="CHAR"/' >

Perhaps what was intended was

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

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: rick.fraser@xxxxxx [mailto:rick.fraser@xxxxxx]
> Sent: 12 May 2005 11:22
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  Finding a String and adding a line
>
> Hi
>  
> I am completely new to this and have to solve a problem at
> work - the XSLT is actually in a product called PeopleSoft,
> but I am using Xray to try to solve my problem.
>  
> I have a piece of code that someone has written (and no
> longer around) - It in itself is not wrong but when the XML
> gets to the destination it expects more and aborts.
>  
>  
> The XML input is something like:
>  
> <?xml version="1.0"?>
> <BT_CONTRACT_PERSON_SYNC>
>     <FieldTypes>
>         <BT_PROV_SYNC class="R">
>             <PERSON_ID type="CHAR"/>
>             <BUSINESS_UNIT type="CHAR"/>
>             <COUNTRY type="CHAR"/>
>         </BT_PROV_SYNC>
>         <SPB_PERSON_TBL class="R">
>             <PERSON_ID type="CHAR"/>
>         </SPB_PERSON_TBL>
>     </FieldTypes>
>     <MsgData>
>         <Transaction>
>             <BT_PROV_SYNC class="R">
>                 <PERSON_ID>600026615</PERSON_ID>
>                 <BUSINESS_UNIT>00001</BUSINESS_UNIT>
>                 <COMPANY>503</COMPANY>
>                 <COUNTRY>GBR</COUNTRY>
>             </BT_PROV_SYNC>
>             <SPB_PERSON_TBL class="R">
>                 <PERSON_ID>600026615</PERSON_ID>
>             </SPB_PERSON_TBL>
>         </Transaction>
>     </MsgData>
> </BT_CONTRACT_PERSON_SYNC>
>  
>  
> The line <COMPANY>... has been successfully added by the
> XSLT, but the destination expects a corresponding entry in
> the <FieldTypes> list, after <BUSINESS_UNIT type="CHAR"/>.
>  
> The line <COMPANY type="CHAR"/> has to be added.
>  
> Here is a cut-down version of the XSLT:
>  
>  
> <?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>
>    <xsl:copy-of select="FieldTypes"/>
>    <MsgData>
>       <!-- Transaction -->
>          <xsl:apply-templates select="MsgData/Transaction"/>
>       <!-- /Transaction -->
>    </MsgData>
> </BT_CONTRACT_PERSON_SYNC>
>  
> </xsl:template>
> <xsl:template match="MsgData/Transaction">
> <Transaction>
>          <xsl:apply-templates select="BT_PROV_SYNC"/>
>          <xsl:copy-of select="SPB_PERSON_TBL"/>
>          <xsl:copy-of select="PSCAMA"/>
> </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>
>  
>  
> <!-inserted code - -->
> <xsl:template match='BUSINESS_UNIT type="CHAR"/' >
>      <BUSINESS_UNIT Type="CHAR"/>
>      <COMPANY Type="CHAR"/>
> </xsl:template>
> <!-- inserted code end -->
>  
> <!-- copy other fields -->
> <xsl:template match="*">
>    <xsl:copy-of select="."/>
> </xsl:template>
> </xsl:stylesheet>
>  
>  
> When I run this through the application or Xray, it fails
> with a message :
>  
> Expected token 'EOF' found 'NAME'.
>  
> BUSINESS_UNIT -->type<--="CHAR"/
>  
>  
> So PLEASE, how is it done?
>  
>  
>  
>  

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.