Copied to clipboard

Flag this post as spam?

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


  • David 9 posts 22 karma points
    Feb 09, 2011 @ 00:33
    David
    0

    XSLT select no longer works! (Umbraco 4.6.1)

    Arghh... this should be really simple but can't figure it out. Scouring both the old and new forums and Google turned up nothing new.

    I am simply trying to re-use content from an existing node (1087) I thought this macro should do the trick.

    A similar technique worked fine on an older version of Umbraco, but not now. Any hints? Am I doing something stupid? Thanks!

     <?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:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:value-of select="umbraco.library:GetXmlNodeById(1087)/data [@alias='bodyText']" disable-output-escaping="yes"/>
    </xsl:template>
    </xsl:stylesheet>

    Also tried this from a very OLD copy of Umbraco, didn't work either:

    <xsl:value-of select="umbraco.library:GetItem(1087, 'bodyText')" disable-output-escaping="yes"></xsl:value-of>

     

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 09, 2011 @ 00:46
    Chriztian Steinmeier
    0

    Hi David,

    If the node does indeed exist, try the following instead of your value-of:

    <textarea cols="25" rows="20">
        <xsl:copy-of select="$currentPage/ancestor-or-self::root//*[@id = 1087]" />
    </textarea>

    This'll work regardless of XML schema used - check the XML returned - if bodyText is an element of itself, e.g. <bodyText>...</bodyText> you're now using the much better new XML Schema and you can proceed with this:

    <xsl:value-of select="$currentPage/ancestor-or-self::root//*[@id = 1087]/bodyText" disable-output-escaping="yes" />

    - otherwise, check back here with the contents of the textarea for further scrutiny...

    /Chriztian

  • David 9 posts 22 karma points
    Feb 09, 2011 @ 01:31
    David
    0

    Hi Chriztian,

    Thank you so much. That worked!

    Using your textarea trick, the output showed that <bodytext>...</bodytext>was indeed part of the output. 

    I'd better brush up on this stuff.

    Gracias :)

    David Duckworth

Please Sign in or register to post replies

Write your reply to:

Draft