Copied to clipboard

Flag this post as spam?

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


  • Mohamed magdy 3 posts 23 karma points
    Mar 01, 2011 @ 14:40
    Mohamed magdy
    0

    old and new schema of Xslt in umbraco

    i am new to unmbraco and i need to differentiate between the between the new and the old schema,also i need to know what is the difference and if there is a tool or a way to know the version of the schema

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 01, 2011 @ 15:34
    Kim Andersen
    2

    Hi Mohamed

    To check whether you are using the new or the old XML schema you can take a look in the /config/umbracoSettings.config-file. FInd this line:

    <UseLegacyXmlSchema>false</UseLegacyXmlSchema>

    If it is set to "false" you are using the new schema otherwise you are using the legacy schema.

    I think you might want to check out the following wiki entry to read a bit about the new schema: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema

    /Kim A

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Mar 01, 2011 @ 16:44
    Chriztian Steinmeier
    2

    Hi Mohamed,

    If you need to differentiate between the two schemas from within an XSLT file, you can do this:

    <!-- Grab the root node -->
    <xsl:variable name="root" select="$currentPage/ancestor::root" />
    
    <!-- Determine if using legacy or v4.5 XML Schema -->
    <xsl:variable name="isLegacyXML" select="boolean(not(/$root/*[@isDoc][1]))" />
    <xsl:variable name="isNewXML" select="not($isLegacyXML)" />
    
    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="$isLegacyXML">
                <!-- Do stuff with old XML schema -->
            </xsl:when>
            <xsl:otherwise>
                <!-- Do stuff with new XML schema -->
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    Also, someone wrote an article about supporting both versions in the same file :-)

    /Chriztian 

Please Sign in or register to post replies

Write your reply to:

Draft