Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I wish to insert an inline image into my XSLT file - but my source code shows that the image is not closing itself properly. My XSLT is:
<a href="{umbraco.library:NiceUrl(@id)}"> <img src="/images/more.jpg" alt="Read more" id="readmore"/> </a>
But the output of this code looks like:
<a href="/news/brand-new-site-for-essex-ice.aspx"><img src="/images/more.jpg" alt="Read more" id="readmore"></a>
As you can see at the very end - the image is not closed properly and there causing a validation error, I need this image to be inline as it will link to my news items.
Cheers, Garry.
Hi Garry,
The quickest way is to change the output method:
<xsl:output method="xml" omit-xml-declaration="yes" />
This will automatically convert all your HTML to XML. Beware of any empty HTML tags you might have... as:
<div></div>
will become:
<div/>
Cheers, Lee.
As an addition to Lee's point, it's a bit hacky but
<div> </div>
Puttin   inside your divs will create a nbsp and keep the div from self-closing
Dan
My output method is already
This is defined in the XSLT file isn't it?
Garry.
Oops - sorry I was looking in the wrong XSLT file
That's done it, I don't use empty div's for anything unless I'm really being "hacky" - but I'll note it down for future reference.
Thanks very much, Garry.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Closing an image in XSLT (page not validating)
Hi,
I wish to insert an inline image into my XSLT file - but my source code shows that the image is not closing itself properly. My XSLT is:
<a href="{umbraco.library:NiceUrl(@id)}"><img src="/images/more.jpg" alt="Read more" id="readmore"/>
</a>
But the output of this code looks like:
As you can see at the very end - the image is not closed properly and there causing a validation error, I need this image to be inline as it will link to my news items.
Cheers, Garry.
Hi Garry,
The quickest way is to change the output method:
This will automatically convert all your HTML to XML. Beware of any empty HTML tags you might have... as:
will become:
Cheers, Lee.
As an addition to Lee's point, it's a bit hacky but
<div> </div>Puttin   inside your divs will create a nbsp and keep the div from self-closing
Dan
My output method is already
This is defined in the XSLT file isn't it?
Garry.
Oops - sorry I was looking in the wrong XSLT file
That's done it, I don't use empty div's for anything unless I'm really being "hacky" - but I'll note it down for future reference.
Thanks very much, Garry.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.