Avoiding that a self-created namespace is passed to the HTML source... Options
Jasko
Posted: Thursday, January 24, 2008 10:54:20 AM
Rank: Devotee

Joined: 12/11/2006
Posts: 47
Hi,

How is it possible to avoid that a self-created namespace is passed on to the HTML code?

In a macro I have a namespace called 'xmlns:TheAgency="urn:my-scripts"', and it is grouped in the top of the XSLT along with the others, like this:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
    xmlns:TheAgency="urn:my-scripts"
    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
    exclude-result-prefixes="msxml msxsl umbraco.library Exslt.ExsltStrings Exslt.ExsltMath"
>


It is being used with a random function. When I view my HTML source the namespace is appearing in the output as follows:
Code:
<div id="speech-box" xmlns:TheAgency="urn:my-scripts">
- Does anyone have a suggestion on why this is happening? And How I can avoid it being passed to the HTML code?

/Jan
PeterD
Posted: Thursday, January 24, 2008 11:38:51 AM

Rank: Fanatic

Joined: 7/20/2006
Posts: 486
Location: NL
Hi Jan,

it is easy to accomplish. Just add your namespace to the exclude-result-prefixes like this:
exclude-result-prefixes="msxml msxsl umbraco.library Exslt.ExsltStrings Exslt.ExsltMath my-scripts"

Hope this helps,
Cheers,
PeterD

Working on an events-calendar with recursion. Post requests on my blog!
Jasko
Posted: Thursday, January 24, 2008 11:54:43 AM
Rank: Devotee

Joined: 12/11/2006
Posts: 47
Hi Peter,

Thank you for your reply. When I do, what you suggest I get this error

"System.Xml.Xsl.XsltException: Prefix 'my-scripts' is not defined."

Should the prefix be defined somewhere else, than within the <xsl:stylesheet> declaration?

/Jan
PeterD
Posted: Thursday, January 24, 2008 11:58:55 AM

Rank: Fanatic

Joined: 7/20/2006
Posts: 486
Location: NL
My bad, instead of my-scripts, use TheAgency

sorry :blush:

Working on an events-calendar with recursion. Post requests on my blog!
Jasko
Posted: Thursday, January 24, 2008 12:14:16 PM
Rank: Devotee

Joined: 12/11/2006
Posts: 47
Hi Peter,

Now it works. Thank you very much :)

/Jan
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.