XML tag appears when adding macro between <title> tags.
Good afternoon.
I've got a simple macro that renders a generic property to the browser. If I add this to the body of the page, my string appears as expected. "Company Name", for example.
However, if I add this to the title tags I get:
?xml version="1.0" encoding="utf-16"?>Company Name
I can't think why this would be happening, especially as it's only when it's between the title tags. The Xslt isn't complex:
I assume if you view source you'll see the same code output - but XML/HTML tags aren't allowed between the <title> tags, so the browser will do some filtering to make sure it doesn't explode.
You should do two things to the above macro:
Change the match attribute to match="/"
Add the omit-xml-declaration="yes" attribute to the <xsl:output> element, which will make sure not to output anything but the value you specify
XML tag appears when adding macro between <title> tags.
Good afternoon.
I've got a simple macro that renders a generic property to the browser. If I add this to the body of the page, my string appears as expected. "Company Name", for example.
However, if I add this to the title tags I get:
I can't think why this would be happening, especially as it's only when it's between the title tags. The Xslt isn't complex:
Thanks in advance for any advice.
Hi Ste,
I assume if you view source you'll see the same code output - but XML/HTML tags aren't allowed between the
<title>
tags, so the browser will do some filtering to make sure it doesn't explode.You should do two things to the above macro:
match="/"
omit-xml-declaration="yes"
attribute to the<xsl:output>
element, which will make sure not to output anything but the value you specifyLike this:
You could actually also change the
method="xml"
tomethod="text"
, since you're only rendering a textfield - but who knows what you'll do later, right?/Chriztian
is working on a reply...