Devin Posted March 1, 2019 Posted March 1, 2019 I've got a simple ( I hope) export as xml issue Here is my current .xsl that is erroring.. My issue is Line 9.. I'm not sure how I need modify the Attribute of Pages? <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fmp="http://www.filemaker.com/fmpxmlresult" xmlns:xalan="http://xml.apache.org/xalan" version="1.0" exclude-result-prefixes="fmp xalan"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="2"/> <xsl:template match="/"> <JDF xmlns="http://www.CIP4.org/JDFschema_1_1" Status="Ready" Type="ProcessGroup" Version="1.2"> <ResourcePool> <RunList Class="Parameter" ID="Link1" Locked="false" PartIDKeys="Run" Status="Available"> <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW"> <RunList Class="Parameter" Pages="<xsl:value-of select="fmp:COL[3]/fmp:DATA"/>" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> </xsl:for-each> </RunList> </ResourcePool> <ResourceLinkPool> <RunListLink Usage="Input" rRef="Link1"/> </ResourceLinkPool> </JDF> </xsl:template> </xsl:stylesheet> Here is an example of what I want to see when I export.. The only real part that changes is the "Pages=" part. <?xml version = "1.0" ?> <JDF Status="Ready" Type="ProcessGroup" Version="1.2" xmlns="http://www.CIP4.org/JDFschema_1_1"> <ResourcePool> <RunList Class="Parameter" ID="Link1" Locked="false" PartIDKeys="Run" Status="Available"> <RunList Class="Parameter" Pages="7" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="8" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="9" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="9" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="10" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="10" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> <RunList Class="Parameter" Pages="0" Run="1"> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> </RunList> </ResourcePool> <ResourceLinkPool> <RunListLink Usage="Input" rRef="Link1"/> </ResourceLinkPool> </JDF>
ggt667 Posted March 1, 2019 Posted March 1, 2019 (edited) Please also add an example: file.fmpxmlresult.xml file. <xsl:template match="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW"> <RunList Class="Parameter" Run="1"> <xsl:attribute name="Pages"> <xsl:value-of select="fmp:COL[3]/fmp:DATA"/> </xsl:attribute> <LayoutElement> <FileSpec URL="file://%2a.pdf"/> </LayoutElement> </RunList> </xsl:template> <RunList Class="Parameter" ID="Link1" Locked="false" PartIDKeys="Run" Status="Available"> <xsl:apply-templates select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW"/> </RunList> How many records are you working with? Template usually spends less memory than for-each Edited March 1, 2019 by ggt667
comment Posted March 1, 2019 Posted March 1, 2019 If I am guessing correctly, instead of: <RunList Class="Parameter" Pages="<xsl:value-of select="fmp:COL[3]/fmp:DATA"/>" Run="1"> you want to do: <RunList Class="Parameter" Pages="{fmp:COL[3]/fmp:DATA}" Run="1"> For explanation of this syntax, see: https://www.w3.org/TR/1999/REC-xslt-19991116#attribute-value-templates Alternatively, you can use the more verbose: <RunList Class="Parameter" Run="1"> <xsl:attribute name="Pages"> <xsl:value-of select="fmp:COL[3]/fmp:DATA"/> </xsl:attribute>
Devin Posted March 1, 2019 Author Posted March 1, 2019 That worked.. Thanks.. and Thanks for the Link.
Recommended Posts
This topic is 2149 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now