Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,I am trying to create a macro that can accept 1 parameters, sourcePath of an xpathI 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)" />
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
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 " "> ]><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>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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)" />
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
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 " "> ]>
<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>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.