Copied to clipboard

Flag this post as spam?

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


  • Darryl Godden 145 posts 197 karma points
    Jan 19, 2010 @ 14:19
    Darryl Godden
    0

    Problem with XSLT (after trying a variety of examples)

    I'm using this XSLT:

    <?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"/>

    <xsl:template match="/">

    <html>
    <body>
    <ul>
        <li><xsl:value-of select="$currentPage/node/node [@alias='tagLine']/text()"/></li>
    </ul>
    </body>
    </html>
    </xsl:template>

    </xsl:stylesheet>

    As a test to show the contents of a node, but I'm not getting any output in the XSLT Visualizer. Are there any glaring mistakes you can see?

    Thanks,

    Darryl

     

     

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jan 19, 2010 @ 14:28
    Dirk De Grave
    0

    Hi,

    need to use 

    <xsl:value-of select="$currentPage/data [@alias='tagLine']"/>

    instead of your xslt statement.

    Explanation: custom properties can be found on a /data subnode

     

    Cheers,

    /Dirk

  • Darryl Godden 145 posts 197 karma points
    Jan 19, 2010 @ 14:30
    Darryl Godden
    0

    Just tried it and there's no output...

    Would it help to post the umbraco.config?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jan 19, 2010 @ 14:33
    Dirk De Grave
    0

    yup, would be great to see that portion of the xml

     

    Cheers,

    /Dirk

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jan 19, 2010 @ 14:36
    Lee Kelleher
    0

    Hi Darryl,

    No need to post your umbraco.config.

    Try the following XSLT to see the XML content of the $currentPage:

    <xmp>
        <xsl:copy-of select="$currentPage" />
    </xmp>

    If you need help understanding how the $currentPage works, take a read of the wiki page about it.

    http://our.umbraco.org/wiki/reference/xslt/understanding-currentpage

    If you still need help, come back here.

    Cheers, Lee.

  • Darryl Godden 145 posts 197 karma points
    Jan 19, 2010 @ 14:36
    Darryl Godden
    0

    Oki doke, here goes:

    <!DOCTYPE umbraco[ <!ELEMENT nodes ANY>  <!ELEMENT node ANY>  <!ATTLIST node id ID #REQUIRED> ]>
    <root id="-1">
      <node id="1080" version="6adffe02-d31c-4925-89b4-e8d26bc51961" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1078" template="1079" sortOrder="2" createDate="2010-01-18T15:09:14" updateDate="2010-01-18T15:23:32" nodeName="Home" urlName="home" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Home" path="-1,1080">
        <data alias="rubbish"><![CDATA[
    <p>hjkhjkhjkhjkghjkhjkghkhjkhjkhkjhjkhjkhgjk</p>
    ]]></data>
        <data alias="script"><![CDATA[]]></data>
        <data alias="pagetitle">Home - Raymond Gubbay</data>
        <data alias="metadescription">
        </data>
        <data alias="metakeywords">
        </data>
        <data alias="shorttitle">
        </data>
        <node id="1088" version="c01ad430-aebe-4655-85d7-3483caec051e" parentID="1080" level="2" writerID="0" creatorID="0" nodeType="1081" template="1082" sortOrder="1" createDate="2010-01-18T16:58:13" updateDate="2010-01-18T16:58:34" nodeName="whatson" urlName="whatson" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Article" path="-1,1080,1088">
          <data alias="pagecontent"><![CDATA[]]></data>
          <data alias="html"><![CDATA[]]></data>
          <data alias="script"><![CDATA[]]></data>
          <data alias="pagetitle">What's On - Raymond Gubbay</data>
          <data alias="metadescription" />
          <data alias="metakeywords" />
          <data alias="shorttitle" />
          <node id="1089" version="e2e39ff5-4791-4348-85a9-fcb5fc5cfc19" parentID="1088" level="3" writerID="0" creatorID="0" nodeType="1085" template="0" sortOrder="1" createDate="2010-01-19T09:41:43" updateDate="2010-01-19T09:43:51" nodeName="Tom Jones" urlName="tom-jones" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Event" path="-1,1080,1088,1089">
            <data alias="venue"><![CDATA[Bristol Hippodrome]]></data>
            <data alias="description"><![CDATA[Tom Jones returns, yes he's still going folks]]></data>
            <data alias="category"><![CDATA[Concert]]></data>
            <data alias="imagemedium">/images/tj.png</data>
            <data alias="imagesmall">/images/tj_small.png</data>
            <data alias="tagline">Tom Jones live</data>

    So the ideal thing is to get items like the tagLine etc...

    Thanks,

    Darryl

  • Darryl Godden 145 posts 197 karma points
    Jan 19, 2010 @ 15:00
    Darryl Godden
    0

    Gah! Case sensitivity of XML, tagLine is actually tagline...

     

    Working version:

    <?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"/>

    <xsl:template match="/">

    <html>
    <body>
    <ul>
        <li><xsl:value-of select="$currentPage/data [@alias='tagline']"/></li>
    </ul>
    </body>
    </html>
    </xsl:template>

  • 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