About EasyMorph Tutorials & Examples Web-help

XSLT Transform not interpreting Parameters?

The EasyMorph XSLT Transformation on an XML file is working great for my XLST template.

However, when I try to add in a parameter using the built-in editor, the parameter name just gets passed as text to the final file, even though the preview shows the result I want.

e.g.: In my XSLT template, I have:

<xsl:attribute name=“timestamp”> {Timestamp} </xsl:attribute>

The preview shows:

<xsl:attribute name=“timestamp”> 2019-10-24T16:14:52-05:00 </xsl:attribute>

Which is correct.

The resulting file however, just shows:

<Invoice
timestamp=" {Timestamp} ">

Am I missing something about how to pass parameters through, or is this a bug?

It’s a bug but it has been fixed. Get an updated version from our website.

Thanks!

I can confirm this is correctly applying parameter’s values rather than their names.

I guess a related question: It seems that when using a XSLT transformation action, Easymorph is adding a new line/line break after the element. Is that expected behavior?

e.g. In the above example, I would expect the output to be
<Invoice timestamp="timestamphere">

However, easymorph’s output becomes

<Invoice
timestamp="{Timestamp}">

Is that expected?

No, it shouldn’t be so. Can you post your XSLT stylesheet or send it to our support?

The whole thing is pretty huge, but here’s everything leading up to and including the impacted section. If the whole thing will be helpful I can send it in.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:json="http://json.org/"
                version="1.0" >
<xsl:template match="/">
     
     <Invoices>
        <xsl:for-each select="//Rows/Row">
              <xsl:variable name="RowId" select="current()/@Id" />
              <Invoice> 
                <xsl:attribute name="timestamp">{Timestamp}</xsl:attribute>
                   <InvoiceHeader>

Try putting it into one line, as below:

<Invoice> <xsl:attribute name="timestamp">{Timestamp}</xsl:attribute>

Sadly, same result as before.

I also tried turning Invoice into an <xsl:element name=“Invoice”> with the attribute contained within it to test, with the same result.

Upon closer inspection it looks like it’s done by EasyMorph. Give us some time - we will add a setting to not insert a new line for attributes.

Thank you kindly for your quick and attentive response!

We’ve added formatting options for output XML files. Get the updated version from our website.

image

To learn more about EasyMorph visit easymorph.com.