Either that error is coming from somewhere else, or you have typed the code
incorrectly.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: rick(_dot_)fraser(_at_)bt(_dot_)com
[mailto:rick(_dot_)fraser(_at_)bt(_dot_)com]
Sent: 12 May 2005 12:07
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Finding a String and adding a line
Thanks prakash and Michael
Tried both variants of your code but get this error when run...
Expression must evaluate to a node-set.
BUSINESS_UNIT[(_at_)type=-->'CHAR'<--/]
Regards, Rick
-----Original Message-----
From: omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in
[mailto:omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in]
Sent: 12 May 2005 11:53
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Finding a String and adding a line
Hi,
If your XSLT processor understand's xpath, your template
<!-inserted code - -->
<xsl:template match='BUSINESS_UNIT type="CHAR"/' >
<BUSINESS_UNIT Type="CHAR"/>
<COMPANY Type="CHAR"/>
</xsl:template>
<!-- inserted code end -->
should be rewritten as
<xsl:template match="BUSINESS_UNIT[(_at_)type= 'CHAR']">
<!-- You can do this if you are sure BUSINESS_UNIT HAS NO
CHILD TEXT NODES
-->
<BUSINESS_UNIT Type="CHAR"/>
-->
<xsl:copy/>
<COMPANY Type="CHAR"/>
</xsl:template>
Cheers,
prakash
<rick.fraser@
bt.com> To:
<'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'>
cc: (bcc:
omprakash.v/Polaris)
05/12/2005 Subject: [xsl]
Finding a String and adding a line
03:52 PM
Please
respond to
xsl-list
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?
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
This e-Mail may contain proprietary and confidential
information and is sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been
misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of
reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message,
contents or its attachment other than by its intended
recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--