Copied to clipboard

Flag this post as spam?

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


  • niccolo rossi 33 posts 53 karma points
    Sep 16, 2011 @ 12:12
    niccolo rossi
    0

    parametric select in xslt

    hi all my friend,

    i've a question for you.

    i have this code:
     <xsl:variable name="test"   select="concat('umbraco.library:GetXmlNodeById(',/macro/Node,')')"/>

    but when i ask the value of test i obtain the string concatenated not the result of the GetXmlNodeByID. 

    how can i resolve this? 

    plz help 

    tnk you

    nico


  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2011 @ 12:23
    Rich Green
    0

    Try this (untested)

     <xsl:variable name="test" select="concat('&quot;',umbraco.library:GetXmlNodeById(/macro/Node), '&quot;')"/>

    Rich

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 16, 2011 @ 12:29
    Fuji Kusaka
    0

    Hi Nico,

    Can you please tell us what you are planning to do? From the code you posted you added the umbraco library Concat, what you could do is remove it

    <xsl:variable name="test" select="umbraco.library:GetXmlNodeById(',/macro/Node,')"/>
  • niccolo rossi 33 posts 53 karma points
    Sep 16, 2011 @ 12:51
    niccolo rossi
    0

    hi,

    i try to explain the problem better:)

    i have a parameter in the macro that contain the IdNode. 

    when i parse the xslt file i need to read and display the info contained in the node with the corresponding id node.

    this is why i've think to use the contain. 

    there is another better way?

    also i've tried this: 

    <xsl:variable name="test" select="concat('&quot;',umbraco.library:GetXmlNodeById(/macro/Node), '&quot;')"/>

    now test contain the node but when i try to read the child nodes with:

              <xsl:value-of select="$test/@id"/> or <xsl:value-of select="$test/categoria"/>

    i receive an error and cant save the xslt file. 

    the error is:

    System.Xml.Xsl.XslLoadException: Expression must evaluate to a node-set. 
    -->$test<-- An error occurred at C:\Documents and Settings\rossi\Documenti\My Web Sites\Umbraco CMS\xslt\634517741395557424_temp.xslt(20,3). 
    at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) 
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    thank you

    nico

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 16, 2011 @ 12:59
    Fuji Kusaka
    0

    Hi Nico,

    So you are trying to access a node using the GetXmlNodeById where this id will never change again right?

    You can do something like

    <xsl:variablename="source"select="1234"/> 

    <xsl:templatematch="/">
     
    <
    xsl:for-eachselect="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
     
    <
    xsl:value-ofselect="yourAlias"/>
    </xsl:template>
Please Sign in or register to post replies

Write your reply to:

Draft