AnsweredAssumed Answered

Some help with an XSLT

Question asked by jrenfrew Expert on Nov 30, 2017
Latest reply on Dec 4, 2017 by jrenfrew

May I prevail on one of you with the knowledge to troubleshoot an XSLT on which I am close but not anywhere near a prize. (field attached for the willing)

 

In general XML returned from an fmi/xml/resultset url and I am struggling to get just the value of one data node back as XML - as it contains XML

 

xml is in form

<fmresultset xmlns="http://www.filemaker.com/xml/fmresultset" version="1.0">

    <error code="0"/>

    <product build="10/27/2016" name="FileMaker Web Publishing Engine" version="15.0.3.308"/>

    <datasource database="zs5" date-format="MM/dd/yyyy" layout="Uploads" table="Uploads" time-format="HH:mm:ss" timestamp-format="MM/dd/yyyy HH:mm:ss" total-count="4"/>

    <metadata>

        <field-definition auto-enter="no" four-digit-year="no" global="no" max-repeat="1" name="flagField" not-empty="no" numeric-only="no" result="text" time-of-day="no" type="normal"/>

        <field-definition auto-enter="no" four-digit-year="no" global="no" max-repeat="1" name="type" not-empty="no" numeric-only="no" result="text" time-of-day="no" type="normal"/>

        <field-definition auto-enter="yes" four-digit-year="no" global="no" max-repeat="1" name="xml" not-empty="no" numeric-only="no" result="text" time-of-day="no" type="normal"/>

    </metadata>

    <resultset count="1" fetch-size="1">

        <record mod-id="16" record-id="13">

            <field name="flagField">

                <data>555</data>

            </field>

            <field name="type">

                <data>Invoice</data>

            </field>

            <field name="xml">

                <data>

                    <Company>pseud0xml here</Company>

                </data>

            </field>

        </record>

    </resultset>

</fmresultset>

 

 

xml is

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fmrs="http://www.filemaker.com/xml/fmresultset"
    exclude-result-prefixes="xs fmrs"
    version="2.0">
    
    
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
    
<xsl:strip-space elements="*"/>
    
    
<xsl:template match="fmrs:fmresultset/fmrs:resultset/fmrs:record[1]/fmrs:field[3]/fmrs:data">
        
<xsl:text>&#xa;</xsl:text>
        
<xsl:copy-of select="node()" />
    
</xsl:template>
    
</xsl:stylesheet>

 

 

but is returning

 

<?xml version="1.0" encoding="UTF-8"?>555Invoice

<Company xmlns="http://www.filemaker.com/xml/fmresultset">

rest or xml...

</Company>

 

As you can see I am getting the correct node returned, but also the text contained in the first two fields - which in not desired

 

and part two:

It is possible to return just <Company> as the root node??

Attachments

Outcomes