Nibble

Advanced property editors for Umbraco v7 and XSLT

xslt

As you could see in the previous couple of posts, in umbraco v7 when creating a more advanced prop editor it will store it’s data as json. But what if you are still using xslt to output your property data to your frontend (yes there are still some folks around that prefer xslt, the sadomasochists of the Umbraco community)

Since json data is useless in xslt we added a new library method that you can use to convert json to xml Smile

<xsl:copy-of select="umbraco.library:JsonToXml($currentPage/matrix)"/>

 

In the case of the matrix prop editor you’ll end up with the following xml

<json>
<arrayitem>
    <arrayitem>xslt</arrayitem>
    <arrayitem>is</arrayitem>
</arrayitem>
<arrayitem>
    <arrayitem>not</arrayitem>
    <arrayitem>dead</arrayitem>
</arrayitem>
</json>

8 Comments so far

  1. Petr Snobelt on November 20th, 2013

    Maybe some parameter, which can change output format to something like this:

    is
    dead

  2. Petr Snobelt on November 20th, 2013

    OOps it eat my tags :-(

  3. Tim Geyssens on November 20th, 2013

    @Petr output format is based on the json, in my case it’s a multi dimensional array so everything is an arrayitem

  4. Petr Snobelt on November 20th, 2013

    @Tim Thank you for clarification.

  5. RazorEmpire on November 21st, 2013

    Xslt as a view engine is most definitely dead, and if you’re doing work for a paying customer it’s unprofessional to be using it!

  6. Chriztian Steinmeier on November 21st, 2013

    @RazorEmpire: You can call me unprofessional all day long - I’m getting paid for professional Umbraco work (with XSLT, yes) and I’ve turned down clients who told me they required me to implement using Razor — and then they come back and ask me to do it my way, when they’ve heard my reasons.

    There are lots of ways to be unprofessional in your job - telling other people how to do their job is one of them, trying to use another view engine which you don’t really understand is another. And that one goes both ways, just so we’re clear…

  7. RazorEmpire on November 21st, 2013

    so the only reason you don’t use razor is because you don’t understand it?

  8. Tim Geyssens on November 21st, 2013

    @RazorEmpire please don’t offend my readers ;) and if you do have the guts to use your real name

Leave a Reply