Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT ERROR

Status
Not open for further replies.

rk03

IS-IT--Management
Apr 8, 2005
4
US
I am using stylus studio as my editor.
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:template match="/ROOT">
<xsl:for-each select="ROW">
<Record>
<Group-RecordKey>
<SystemID>CCO</SystemID>
<LocationCode>
<xsl:value-of select="./officeid"/>
</LocationCode>
<ClientCode>
<xsl:value-of select="./ClientId"/>
</ClientCode>
<ProjectCode>
<xsl:value-of select="./contactquename"/>
</ProjectCode>
<LetterCode>
<xsl:value-of select="./contentid"/>
</LetterCode>
<LetterDate>
<xsl:value-of select="./createdate"/>
</LetterDate>
<AccountNumberPlacementId>
<xsl:value-of select="./placementid"/>
</AccountNumberPlacementId>
<PackageNumber>
<xsl:value-of select="./accountno"/>
</PackageNumber>
</Group-RecordKey>
</Record>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

This is my xslt code.
However on running it on my browser i am gettign this error
:
Only one top level element is allowed in an xml document.Error processing resource.


Please help!!!!!
Thanks in advance
 
What do you mean run it? Are you referencing this XSL from another XML file? If so, the other XML file is probably invalid.
 
I have an input xml which looks like this for 1 row
<ROOT>
<ROW RowNum="1">
<ClientId>ABC</ClientId>
<ContractId>XYZ</ContractId>
<plid>MMM</plid>
<ROw>
<ROW>
....
</ROW>
<ROW>.... </ROW>
mutliple rows
</ROOT>
using the above xsl this needs to transform into
<ROW>
<GROUP1>
<ClientID>ABC</CLIENTID>
</GROUP1>
<GROUP2>
<Contractid>XYZ</CONTRACTID>
</GROUP2>
<GROUP3>
<plid>MMM</plid>
</GROUP3>
</ROW>
and repeat this for multiple rows

Now on trying this for one row(without the for-each select tag) it works good.
On inclusion of the for-each select tag the error pops up at most one root element allowed.

Hope this is more clear now.
And as for your question of the xsl ... yes that s the complete file.

Thanks

 
I fixed the issue by myself.
Thanks for your help everyone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top