Copied to clipboard

Flag this post as spam?

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


  • manikandan 7 posts 27 karma points
    May 03, 2012 @ 12:28
    manikandan
    0

    dyanamic xpath in umbraco4.7

    Hi,

    I am trying to create a macro that can accept 1 parameters, sourcePath of an xpath

    I would liket to concatenate these to generate an xpath of  image as follows can anyone tell me what is wrong?


    <xsl:param name="sourcePaths" select="macro/sourcePath" />
    <xsl:param name="siteimage" select="$currentPage/*[name()=$sourcePaths]" />
    <xsl:variable name="mediaId" select="number($siteimage/imageurl)" />

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 03, 2012 @ 12:48
    Chriztian Steinmeier
    0

    Hi manikandan,

    You can use the umbraco.library:GetXmlNodeByXPath() extension for that - NOTE: The examples on that page use the old XMLSchema...

    If you can't figure out how to do it, let us know and we'll help you get it to work.

    /Chriztian

  • manikandan 7 posts 27 karma points
    May 03, 2012 @ 13:43
    manikandan
    0

    Hi chriztian,

    Actually i am new bee for umbraco. i don't know where to call "umbraco.library:GetXmlNodeByXPath() " this function,Please look at the below xslt code. and tell me where to apply. thanks in advance

    <?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"/>
    <!-- start writing XSLT --> 


    <xsl:template match="/">
    <xsl:param name="sourcePaths" select="macro/sourcePath" />
      <xsl:param name="siteimage" select="concat(concat('$currentPage','/',$sourcePaths),'/','imageurl/')" />
    <xsl:variable name="mediaId" select="number($siteimage)" />
    <xsl:if test="$mediaId > 0">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
            <xsl:if test="$mediaNode/umbracoFile">
                <img src="{$mediaNode/umbracoFile}" height="{@umbracoHeight}" width="{@umbracoWidth}" alt="($mediaNode/nodeName)" />

            </xsl:if>
        </xsl:if>   
    </xsl:template>
    </xsl:stylesheet>

Please Sign in or register to post replies

Write your reply to:

Draft