Search

Hello,

I'm new to symphony cms. I have attached a file.

%7C output instead of pipe character for google fonts.

Final result:

I have a "Section" called Asset and a "Data Source" called Asset.

In the Asset Section I have a field called - Google web fonts - Handle [google-web-fonts] - Text Formatter [None]

XML Data for Home page in ?debug Assets<![CDATA[Roboto+Slab:100,300,400,700|Quattrocento+Sans:400,700]]>

/utilities/master.xsl

<link href='//fonts.googleapis.com/css?family={google-web-fonts}' rel='stylesheet' type='text/css' />

Thank you for your help.

Cannot edit my post :(

Final Result:

<link href="//fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700%7CQuattrocento+Sans:400,700" rel="stylesheet" type="text/css">

XML Data for Home page in ?debug

<asset>
    <section id="7" handle="assets">Assets</section>
        <entry id="7">
        <google-web-fonts><![CDATA[Roboto+Slab:100,300,400,700|Quattrocento+Sans:400,700]]></google-web-fonts>
    </entry>
</asset>

/utilities/master.xsl

    <link href='//fonts.googleapis.com/css?family={google-web-fonts}' rel='stylesheet' type='text/css' />
</xsl:template>

<xsl:template match="/">
    <xsl:apply-templates select="/data/asset/entry" />
</xsl:template>
Attachments:
section_asset.jpg

Weird, when i replicate this it outputs fine...
Hope someone else has any idea?

Edit: Oh by the way, there's an 'edit' button under your avatar ;-)

Hello Cremol,

I get an error when editing this post. I do not why :(

<link href='//fonts.googleapis.com/css?family={google-web-fonts}' rel='stylesheet' type='text/css' />

The line above is converting pipe character to %7C.

Thanks!

I understand your problem, but it works fine if i replicate it.
And i have no idea what's the cause unfortunately...

How weird. Definitely unexpected.

Is the pipe retained if you simply output the xpath into your page body? i.e. is it only doing it when applying it to that URL in the <head>, or is it always parsing that way?

Edit: Not that it should matter, as the XML output looks fine, but what field are you using here?

Hello nathanhornby,

Yes, it outputs normal with the pipe character. Using the href link is the problem.

I'm using the field called "Google web fonts" [google-web-fonts].

<link rel="stylesheet" type='text/css'>
  <xsl:attribute name="href">
    <xsl:text>//fonts.googleapis.com/css?family=</xsl:text>
    <xsl:value-of select="google-web-fonts" disable-output-escaping="yes" />
  </xsl:attribute>
</link>

I did it differently with no luck.

Thank you!

So weird. I'd be tempted to suggest it's something to do with the extension, but as I say, the XML looks fine, and in this case, the buck stops there.

Where are you testing this, on a server or locally? Are you able to test somewhere else? I wonder if the XSLT parser could be to blame?

Have you tried checking to see if the same thing happens if you just use a normal text field? I can't imagine it would be different, but worth a try.

If you're only seeing it in the head, I wonder if this is intentional behaviour from Symphony for some reason. As something is treating it different due to where it's outputting.

I'm testing this locally.

Edit: I will try that.

Getting the same results with a new Text field.

Thanks!

I've just done a quick test (I only have access to a 2.5 build, although probably not relevant) and can't replicate it with a text field. I get the expected output, even if using it in the head and a placing it in a link, exactly as you are (with and without the CDATA).

So if you're still seeing it with a normal text field I'm afraid you might have a wild goose chase on your hands!

Yes, (with and without the CDATA). I'm getting the same results.

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