Copied to clipboard

Flag this post as spam?

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


  • Jameskn 64 posts 78 karma points
    Jun 27, 2010 @ 13:58
    Jameskn
    0

    V4.5 XLST string(data [@alias='MenuName'])

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

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <pre>
        <xsl:copy-of select="." />
          </pre>
    <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>- <xsl:value-of select="string(data [@alias='MenuName'])"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    Coming very unstuck in v4.5 when I import my scripts. Just created above off the template as a test case for string(data [@alias='MenuName'])

    It does not return anything or a value.

    Below is the using <xsl:copy-of select="." /> this is what it returns for node.

    <pre><StandardMain id="1050" parentID="1047" level="2" writerID="0" creatorID="0" nodeType="1044" template="1045" sortOrder="2" createDate="2010-06-27T11:43:15" updateDate="2010-06-27T11:47:24" nodeName="Services" urlName="services" writerName="Administrator" creatorName="Administrator" path="-1,1047,1050" isDoc=""><PageTitle>Services</PageTitle><Body>

    &lt;p&gt;Services&lt;/p&gt;
    </Body><ShowInMenu>0</ShowInMenu><MainImagePicker /><MenuName>Services</MenuName><umbracoRedirect /><metaKeywords /><metaDescription /></StandardMain></pre>
    So you can see <MenuName>Services</MenuName> is there
    Has all the XSLT stuff changed in 4.5? What do I need to pull values now out of nodes.
    Any help would be great or just pointing me towards the documentation ;)
    Cheers,
    James

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 27, 2010 @ 15:46
    Kim Andersen
    0

    James, instead of data[@alias='MenuName'] I'm pretty sure that you can just use MenuName. Like this:

    <xsl:value-of select="string(MenuName)" />

    Does that make sense? If that doesn't work either, you could try putting a ./ in front of the MenuName. But the above should work in my head :)

    /Kim A

  • Jameskn 64 posts 78 karma points
    Jun 27, 2010 @ 16:28
    Jameskn
    0

     

    Many thanks that works.

    ;) I must be using old methods to call stuff.

    Cheers,

    James

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jun 27, 2010 @ 16:43
    Kim Andersen
    0

    Perfect James. Yeah, the new Schema have "taken care" of the data[@alias=' '], so that we now only have to type in the alias of the field to be used. I think it's a big step in the right direction.

    By the way, remember to mark this post as solved if you find your answer solved :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft