Copied to clipboard

Flag this post as spam?

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


  • Ted Jardine 98 posts 120 karma points
    Oct 06, 2009 @ 20:45
    Ted Jardine
    0

    Use macro parameter in GetXmlDocument($file, 1)

    In using Darren Ferguson's XSLT Feed Cache package (http://our.umbraco.org/projects/feed-cache) I want to know in the consumption of the generated XML file how to use a macro parameter in GetXmlDocument($file, 1) where $file is:

    <xsl:variable name="file" select="/macro/filePath"/>

    Even better, how can I hard code the root of the path, but concat in the actual file name? Dealing with quote characters is killing me here!

    I.e.

    <xsl:variable name="feed" select="concat('/umbraco/plugins/FergusonMoriyama/FeedCache/', 'blog.xml')" />
    <xsl:variable name="feedContent" select="umbraco.library:GetXmlDocument($feed, 1)/Atom:feed"/>

    The above doesn't work

    <xsl:variable name="feed" select="'/umbraco/plugins/FergusonMoriyama/FeedCache/blog.xml'" /> <!-- Note the necessary ' characters -->
    <xsl:variable name="feedContent" select="umbraco.library:GetXmlDocument($feed, 1)/Atom:feed"/>

    This does work, but then I'm back to hardcoding the entire path in the XSLT. I've tried various configurations of http://www.mail-archive.com/[email protected]/msg01393.html to see if that helps, but obviously, the real issue is my lack of understanding exactly when the variable is being treated as a string or not.

     

    Umbraco 4.0.2.1
    ASP.NET 3.5
    Windows 2008 x64/IIS 7

  • Edward Dudley 80 posts 121 karma points
    Oct 08, 2009 @ 10:46
    Edward Dudley
    0

    I don't know if this would help, but I have used a string function before to force a variable to behave as a string.

    So string($var).

    I don't see anything wrong with your code that doesn't work though - I would expect that to work!

  • Ted Jardine 98 posts 120 karma points
    Nov 10, 2009 @ 02:34
    Ted Jardine
    0

    Well, it turns out it was as simple as:

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }A { text-decoration: none; font-weight: bold; color:#000000;}.S2 { font-weight: bold; color: #800080; }.S4 { color: #8B0000; }.S5 { color: #009300; }.S1 { color: #00008B; }.S3 { color: #7D9EC0; }<xsl:variable name="theFile" select="/macro/filePath"/>
    <xsl:variable name="feed" select="concat('/umbraco/plugins/FergusonMoriyama/FeedCache/', string($theFile))" />

    As opposed to:

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }A { text-decoration: none; font-weight: bold; color:#000000;}.S2 { font-weight: bold; color: #800080; }.S4 { color: #8B0000; }.S5 { color: #009300; }.S1 { color: #00008B; }.S3 { color: #7D9EC0; }<xsl:variable name="theFile" select="/macro/filePath"/>
    <xsl:variable name="feed" select="concat('/umbraco/plugins/FergusonMoriyama/FeedCache/', $theFile)" />

    Thanks!

  • Ted Jardine 98 posts 120 karma points
    Nov 10, 2009 @ 02:36
    Ted Jardine
    0

    -- Without formatting gone bad --

    Well, it turns out it was as simple as:

    <xsl:variable name="theFile" select="/macro/filePath"/>
    <xsl:variable name="feed" select="concat('/umbraco/plugins/FergusonMoriyama/FeedCache/', string($theFile))" />

    As opposed to:

    <xsl:variable name="theFile" select="/macro/filePath"/>
    <xsl:variable name="feed" select="concat('/umbraco/plugins/FergusonMoriyama/FeedCache/', $theFile)" />

    Thanks!

  • 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.

Please Sign in or register to post replies