document() function returning non-XML data?
Added by Anonymous over 17 years ago
Legacy ID: #4188457 Legacy Poster: CRA (samurai40k)
Hi there, My goal is to re-order the data in a source document so that it is in the same order as another, similar document. To do this I want to load the secondary 'model' document into an xsl:param using the document() function and use it as a reference for re-ordering the data in the source document. Here is a sample of what the data in the model document looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ImageComparatorPublicationProfile> <ProfileMetaData> <ProfileDate>2007-03-01</ProfileDate> <UserWhoRan>jack</UserWhoRan> <SourcePublicationPath>/candoc/prd/it1/cchcfm01.dat</SourcePublicationPath> <SourceFileDate>2006-07-12</SourceFileDate> <PublicationLoadDate>2003-09-01</PublicationLoadDate> </ProfileMetaData> <PublicationMetaData> <PubVolAcronym>CFM01</PubVolAcronym> <PublicationId>4482</PublicationId> <PubVolTitle>Commodity Futures Modernization -- Law and Explanation</PubVolTitle> </PublicationMetaData> <GrossCounts> <NumberOfTocNodes>180</NumberOfTocNodes> <NumberOfDocuments>134</NumberOfDocuments> <NumberOfDocumentTypes>4</NumberOfDocumentTypes> <TotalNumberOfWordsInDocuments>75198</TotalNumberOfWordsInDocuments> <TotalNumberOfStrippedContentTextBytes>488314</TotalNumberOfStrippedContentTextBytes> <TotalNumberOfMarkedUpContentTextBytes>559997</TotalNumberOfMarkedUpContentTextBytes> <TotalNumberOfDocumentsWithMultiparents>0</TotalNumberOfDocumentsWithMultiparents> <TotalNumberOfLinksInContent>283</TotalNumberOfLinksInContent> <TotalNumberOfLinkTargets>101</TotalNumberOfLinkTargets> <TotalNumberOfTables>0</TotalNumberOfTables> <TotalNumberOfFootnotes>0</TotalNumberOfFootnotes> <TotalNumberOfFootnoterefs>0</TotalNumberOfFootnoterefs> <TotalNumberOfCautionLines>0</TotalNumberOfCautionLines> <TotalNumberOfImageReferences>0</TotalNumberOfImageReferences> <TotalNumberOfUniqueImages>0</TotalNumberOfUniqueImages> </GrossCounts> </ImageComparatorPublicationProfile> Here is the code I have written so far: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dctm="http://www.documentum.com" xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="dctm saxon"> <xsl:output doctype-public="-//CCH INCORPORATED//DTD Group XML//EN" indent="yes" encoding="UTF-8" method="xml" saxon:character-representation="decimal"/> <xsl:template match="/"> <xsl:param name="PRD-DOC"> <xsl:copy-of select="document('cfm01-prd.xml')"/> </xsl:param> <xsl:value-of select="$PRD-DOC"/> <xsl:copy-of select="//BestSelfLink"/> </xsl:template> </xsl:stylesheet> Using this code, the //BestSelfLink part outputs the correct subset of XML since it directly references nodes in the the source document specified in the command line. However, while the output of the $PRD-DOC variable successfully returns all of the data in the model document, none of it is contained within XML markup. I have tried this several different ways and everything returns the same result. I know I'm probably missing something very small in my document() function call, but I can't for the life of me figure out what it is. Thanks in advance for any help.
Replies (1)
RE: document() function returning non-XML dat - Added by Anonymous over 17 years ago
Legacy ID: #4208081 Legacy Poster: CRA (samurai40k)
I figured it out. I was using copy-of instead of value-of to assign the variable.
Please register to reply