March 22, 200520 yr I am trying to export an XML document to import into Endicia. So far everything works except the Package ID value. It is supposed to output <Package ID = 1><Package ID = 2> and so on for each record. However, when I try to use fmp:ROW it doesn't work. If I use any other field name it works fine. What am I doing wrong? Here is the stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fmp"> <xsl:output method="xml" version="1.0" standalone="yes" indent="yes" encoding="iso-8859-1"/> <xsl:template match="fmp:FMPDSORESULT"> <DAZzle> <xsl:attribute name="Start"> <xsl:text>PRINTING</xsl:text> </xsl:attribute> <xsl:attribute name="Prompt"> <xsl:text>YES</xsl:text> </xsl:attribute> <xsl:attribute name="OutputFile"> <xsl:text>/Users/careypeoples/Documents/endicia_output.xml</xsl:text> </xsl:attribute> <xsl:attribute name="Test"> <xsl:text>NO</xsl:text> </xsl:attribute> <xsl:apply-templates select="fmp:ROW"/> </DAZzle> </xsl:template> <xsl:template match="fmp:ROW"> <Package> <xsl:attribute name="ID"> <xsl:value-of select="fmp:ROW" /> </xsl:attribute> <xsl:apply-templates select="fmp:Mail_Class" /> <xsl:apply-templates select="fmp:Days_in_Advance" /> <xsl:apply-templates select="fmp:Weight" /> <xsl:apply-templates select="fmp:Description" /> <xsl:apply-templates select="fmp:Name1" /> <xsl:apply-templates select="fmp:Name2" /> <xsl:apply-templates select="fmp:Address1" /> <xsl:apply-templates select="fmp:Address2" /> <xsl:apply-templates select="fmp:City" /> <xsl:apply-templates select="fmp:State" /> <xsl:apply-templates select="fmp:Zip" /> </Package> </xsl:template> <xsl:template match="fmp:Mail_Class"> <MailClass> <xsl:value-of select="."/> </MailClass> </xsl:template> <xsl:template match="fmp:Days_in_Advance"> <DateAdvance> <xsl:value-of select="."/> </DateAdvance> </xsl:template> <xsl:template match="fmp:Weight"> <WeightOz> <xsl:value-of select="."/> </WeightOz> </xsl:template> <xsl:template match="fmp:Description"> <Description> <xsl:value-of select="."/> </Description> </xsl:template> <xsl:template match="fmp:Name1"> <ToName> <xsl:value-of select="."/> </ToName> </xsl:template> <xsl:template match="fmp:Name2"> <ToCompany> <xsl:value-of select="."/> </ToCompany> </xsl:template> <xsl:template match="fmp:Address1"> <ToAddress1> <xsl:value-of select="."/> </ToAddress1> </xsl:template> <xsl:template match="fmp:Address2"> <ToAddress2> <xsl:value-of select="."/> </ToAddress2> </xsl:template> <xsl:template match="fmp:City"> <ToCity> <xsl:value-of select="."/> </ToCity> </xsl:template> <xsl:template match="fmp:State"> <ToState> <xsl:value-of select="."/> </ToState> </xsl:template> <xsl:template match="fmp:Zip"> <ToPostalCode> <xsl:value-of select="."/> </ToPostalCode> </xsl:template> </xsl:stylesheet>
March 22, 200520 yr The line <xsl:value-of select="fmp:ROW" /> would select a ROW node and all its subnodes of your rows in the XML result set tree. Obviously this can not work, because this XML result tree set does not carry an ID, but a record and all its field information, e.g. field names and data. What you need is the position of the current context, which is fmp:ROW in your <xsl:template match="fmp:ROW">. There, change <xsl:template match="fmp:ROW"> <Package> <xsl:attribute name="ID"> <xsl:value-of select="fmp:ROW" /> </xsl:attribute> . . . to <xsl:template match="fmp:ROW"> <xsl:variable name="currentrecord" select="position()"/> <Package> <xsl:attribute name="ID"> <xsl:value-of select="$currentrecord" /> </xsl:attribute . . . Martin
Create an account or sign in to comment