Copied to clipboard

Flag this post as spam?

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


  • Moran 277 posts 885 karma points
    Aug 12, 2013 @ 10:30
    Moran
    0

    Reading xml tags from url

    Hi I want to read this xml using xslt but for some reason I can't access the tags. this is my code:

    <xsl:template match="/">
    <!-- start writing XSLT -->
    <xsl:variable name="dateString" select="concat('http://www.hebcal.com/converter/','?cfg=xml&amp;gy=2013&amp;gm=8&amp;gd=11&amp;g2h=1')" />
    <xsl:variable name="MyFeed" select="umbraco.library:GetXmlDocumentByUrl($dateString)" />
     <!--<xsl:variable name="MyFeed" select="umbraco.library:GetXmlDocumentByUrl('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml')" />-->
      <span>
        <xsl:value-of select="$MyFeed"/>
      </span>
      <span>
        <xsl:value-of select="$dateString"/>
      </span>
      <ul class="hebrewDate">
        <xsl:for-each select="$MyFeed">
          <li><xsl:value-of select="hebrew" /></li>
        </xsl:for-each>
      </ul>
    </xsl:template>
    </xsl:stylesheet>
    

    the part of $dateString is working fine and I am getting the right URL, but I want to get the str value inside the hebrew tag.

    this is the XML example

    <hebcal>
    <gregorian year="2013" month="8" day="11"/>
    <hebrew year="5773" month="Elul" day="5" str="ה׳ בְּאֱלוּל תשע״ג"/>
    </hebcal> 
    
  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Aug 12, 2013 @ 10:40
    Chriztian Steinmeier
    100

    Hi Moran,

    Your $MyFeed variable contains the XML document, so you need to use an XPath to extract the data, e.g.:

    <ul class="hebrewDate">
        <li><xsl:value-of select="$MyFeed/hebcal/hebrew/@str" /></li>
    </ul>
    

    /Chriztian

  • Moran 277 posts 885 karma points
    Aug 12, 2013 @ 10:58
    Moran
    0

    Thanks :) working great

  • 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