Copied to clipboard

Flag this post as spam?

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


  • Amigo 243 posts 568 karma points
    Sep 03, 2010 @ 10:59
    Amigo
    0

    retreive genereric propperty

    I have a true/false propperty true/false alias "showImage".

    How can i test in xsl for it? 

    something ala:

       <xsl:if test=" data [@alias = 'showImage'] = '0' ">

     

     

    </xsl:if>

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 03, 2010 @ 11:25
    Thomas Höhler
    0

    Therefore that a true/false property can be unclicked (uninitialized) it is better to test against the true value:

    <xsl:if test="data [@alias = 'showImage'] != '1'">...

    or for the new schema (4.5):

    <xsl:if test="showImage != '1'">...

    hth, Thomas

  • Amigo 243 posts 568 karma points
    Sep 03, 2010 @ 11:33
    Amigo
    0

    hmmm, i wonder none of it is working, i must do something wrong...

    <?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="/">
    <!-- start writing XSLT -->
    <xsl:if test="data [@alias = 'showImage'] != '1'">
    true...
    </xsl:if>
    <xsl:if test="showImage != '1'">
    true again...
    </xsl:if>
    </xsl:template>

    </xsl:stylesheet>

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 03, 2010 @ 12:07
    Thomas Höhler
    0

    Do  you get an error? or is it empty? Which Umbraco Version do you use and if you use 4.5.x which schema do you use, the old one (legacy) or the new one?

    Did you check the values? Did you check for typos (it's CaseSensitive).

    Cheers, Thomas

  • Amigo 243 posts 568 karma points
    Sep 03, 2010 @ 12:14
    Amigo
    0

    its just empty....

    i use a 4.xx upgraded to 4.5

    i created a propperty with alias: "showImage" type true/false on a tab on my document type...

    then i just created a macro "Teaser_ Subpage" and got a Teaser_Subpage.xslt to it. 

    then i have inserted the macro on my subpage template....

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Sep 03, 2010 @ 13:42
    Thomas Höhler
    1

    OK, you are working on 4.5. In 4.5 the xml schema changed (see http://our.umbraco.org/wiki/reference/xslt/45-xml-schema).

    Please check the UseLegacyXmlSchema setting in the config/UmbracoSettings.config

    If it is set to true you are using the old schema. If it is set to false you are using the new schema. be sure that you have republished the content or use the republish described in http://our.umbraco.org/wiki/reference/xslt/mixed-schemas-after-upgrade

    If you run the xslt on a page you also have to use the $currentPage param to get the actual node. So the code would be like this:

    <xsl:template match="/">

    <xsl:if test="$currentPage/showImage == '1'">
    true
    </xsl:if>

    </xsl:template>

    or to check for showImage = false

    <xsl:template match="/">

    <xsl:if test="$currentPage/showImage != '1'">
    false
    </xsl:if>

    </xsl:template>

    hth, Thomas

  • Amigo 243 posts 568 karma points
    Sep 06, 2010 @ 09:34
    Amigo
    0

    Thanks a lot, that fixed my problems.

    Have a great day ;-)

Please Sign in or register to post replies

Write your reply to:

Draft