Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Owen 13 posts 105 karma points
    Nov 17, 2023 @ 13:26
    Owen
    0

    XSLT file help

    I'm upgrading from Umbraco 7 to Umbraco 10 and the XSLT files I have been using in Umbraco 7 no longer work in Umbraco 10.

    Can anyone help identify why this might be? The code I'm using is below.

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:user="urn:my-scripts"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="xsl msxsl user umbraco.library">
    
    <xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="DTD/xhtml1-strict.dtd" cdata-section-elements="script style" indent="yes" encoding="utf-8"/>
    
    <xsl:param name="records" />
    
    <xsl:template match="/">
    
    <p>Dear <xsl:value-of select="$records//fields/child::* [caption = 'Name']//value"/>,</p>
    
    <p>*Body copy*</p>
    
    
    </xsl:template>
    
    </xsl:stylesheet>
    
  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Nov 22, 2023 @ 15:45
    Marc Goodson
    0

    Hi Owen

    Is this in a custom 'Send XSLT transformed email' Workflow step on an Umbraco Form?

    I haven't found an example one (sure there used to be one that you could edit for your own purposes :-() for V10...

    ... first thought though is your XSLT has a namespace called umbraco.library

    And I know this was removed in the move to Umbraco 8.

    if you aren't using the extension methods that used to be in umbraco.library then you might just be able to remove that from your XSLT file?

    There maybe errors in the trace logs that would help pin down which bits are being complained about and work through by trial and error.

    There is an alternate way to do Email Templates with a Razor file, that might be more straightforwards but depends how many you have to convert! hopefully removing the namespace will just do it... or at least get you further down the path.

    regards

    Marc

  • Owen 13 posts 105 karma points
    Nov 24, 2023 @ 13:12
    Owen
    0

    Hi Marc,

    Yes that's correct, this is the 'Send XSLT transformed email' workflow in Umbraco Forms.

    I've tried removing the reference to 'umbraco.library' but unfortunately it's still not working.

    I have maybe six forms that I need to use this on. I'm not familiar with the Razor files so would rather use the XSLT file but I can't find an example one for Umbraco 10 anywhere.

    Thanks

    Owen

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 24, 2023 @ 22:17
    Chriztian Steinmeier
    0

    Hi Owen,

    For that specific file you can take out the other namespaces as well, to end up with something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="DTD/xhtml1-strict.dtd" cdata-section-elements="script style" indent="yes" encoding="utf-8"/>
    
      <xsl:param name="records" />
    
      <xsl:template match="/">
    
        <p>Dear <xsl:value-of select="$records//fields/child::* [caption = 'Name']//value"/>,</p>
    
        <p>*Body copy*</p>
    
    
      </xsl:template>
    </xsl:stylesheet>
    

    (Provided the Body copy part doesn't reference any of them)

    If this doesn't work, I'd love to see the specific errormessage(s) to pinpoint what's wrong.

    /Chriztian

  • Owen 13 posts 105 karma points
    Nov 28, 2023 @ 15:20
    Owen
    0

    Thanks Chriztian. I've tried using that but unfortunately it hasn't worked. Do you know how I find an error message to identify what's wrong? The workflow audit in Umbraco just says it failed.

    I've also asked our web developer and they've come back and said the below piece of code is what's not working, but we don't know why or what it should be.

    $records//fields/child::
    
Please Sign in or register to post replies

Write your reply to:

Draft