Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Blair 466 posts 731 karma points
    Aug 04, 2011 @ 01:22
    Paul Blair
    0

    Prefix not defined

    Hi,

    I would like to output some code in XSLT in the format:

                    <div class="addthis_toolbox addthis_default_style"
                         addthis:url="http://example.com"
                         addthis:title="An Example Title">

    But XSLT tries to define addthis as a Namespace whereas I just want it output as it is. It results in a "Namespace prefix is not defined" error. Is there anyway around this?

    Thanks

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Aug 04, 2011 @ 01:45
    Chriztian Steinmeier
    0

    Hi Paul,

    Generating prefixed elements (and attributes) requires that the prefix be bound to a Namespace URI - you can just define the prefix in your top-level <xsl:stylesheet> along with all the others:

    <xsl:stylesheet version="1.0"
       xmlns:xsl="..."
       xmlns:umbraco.library="..."
       xmlns:addthis="http://somenamespace.com"
    > ...

    Then you're allowed to generate those attributes.

    It's an error to generate prefixed elements/attributes without defining the Namespace URI for them, so the processor will output the namespace declaration in the top-most element in your frontend (usually <html> or <body> but your mileage may vary...)

    /Chriztian

  • Paul Blair 466 posts 731 karma points
    Aug 07, 2011 @ 06:24
    Paul Blair
    0

    Thanks Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft