Subject: [xsl] Finding a String and adding a line From: <rick.fraser@xxxxxx> Date: Thu, 12 May 2005 11:22:15 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] splitting terms with [A-Z, Rahil | Thread | Re: [xsl] Finding a String and addi, David Carlisle |
[xsl] splitting terms with [A-Z] ex, Rahil | Date | Re: [xsl] splitting terms with [A-Z, David Carlisle |
Month |