Search

Hi people,

I've set up Symphony with some extensions and started to build a test-drive site. I have to admit, I started XSL when I installed Symphony like 3 weeks ago...

So, I wrote a little template to display common Messages. This is the XML-Input it should accept:

<result type="error|success|notice">
    <title>Message Title</title>
    <messages>
        <message>Message 1</message>
        <message>Message 2</message>
        ...
    </messages>
</result>

(I may extend it later, or change it...)

From a common POST-(Error-) Event I get this XML result:

<events>
    <eventTitle result="error">
        <message>Message Title</message>
        <fieldName1 label="label1" type="missing|invalid" message="Field Message 1" />
        <fieldName2 label="label2" type="missing|invalid" message="Field Message 2" />
    </eventTitle>
</events>

How do I transform Symphony's result into my desired format?

As well: Since I want to use my template to display custom-messages (not coming from POST-Results etc), how do I create the XML-Data to feed my template? I tried things like xsl:element, but it always prints the content to screen only :D

As I said, I'm quite new to XSL...

Greetings

maybe that way ? my eventname is msg, so change this...

<xsl:choose>
<xsl:when test="not(events/msg) or events/msg[@result != 'success']" >
<!-- do something -->
<xsl:for-each select="/data/events/msg/*">
<xsl:choose>

<xsl:when test="[@type = 'missing' or @type = 'invalid' ]" >
<!-- do something -->
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>

don't know wheter wildcard is ok in foreach loop, is test in difference templates.

like this gist: https://gist.github.com/strlcp/6602414

Maybe this combined with @moma's comment gives you a direction:
http://xpathr.com/view/6605825/067576942bcb2a4cd987fa3d636258c48f1f762a/

Thank you for the help,

I managed to fix my problem with your advice :) Solution: Instead of writing it how I am used to do it, I transformed my way of thinking so that XSL accepts it ;)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details