The thing is that for some reason I can't get the value of yt:location..I whould guess its because of the namepsace..but Im not sure...so..anyway...how do I get the value of for instance in this case yt:location?
And by the way..any suggestions of improvments to this xslt-file is appreciated :)
And then also added the prefix "yt" to the exclude-result-prefixes attribute :) and then used <xsl:value-of select = "*[local-name()='location']" disable-output-escaping="yes" />
What I was trying to tell you was that because you have declared the prefix (with xmlns:yt="...") you can (and should) use the full qualified name (yt:location) to access the element. It's that simple, and exactly how you do namespace stuff in XSLT.
Namespace problem? Youtube API
Hi!
Im trying to access some of the data from the youtube API by useing the following XSL
<?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"
xmlns:yt="gdata.youtube.com/feeds/api/videos/ADos_xW4_J0"
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="/">
<!-- start writing XSLT -->
<xsl:variable name="Feed" select="umbraco.library:GetXmlDocumentByUrl('http://gdata.youtube.com/feeds/api/videos/ADos_xW4_J0')" />
<xsl:for-each select="$Feed/*[local-name()='entry']">
<xsl:value-of select = "*[local-name()='yt:location']" disable-output-escaping="yes" />
<hr/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The thing is that for some reason I can't get the value of yt:location..I whould guess its because of the namepsace..but Im not sure...so..anyway...how do I get the value of for instance in this case yt:location?
And by the way..any suggestions of improvments to this xslt-file is appreciated :)
Thanks in advance!
Not sure if this will help, but you might want to have a look at uTube. It has some nice xslt samples: http://utube.codeplex.com/SourceControl/changeset/view/8325#196501
Jeroen
Hi Inx51,
You've declared the namespace, so you should just be able to do:
In fact - these should all work:
/Chriztian
Thanks :)..I did an ugly hack for it(atleast as I see it)..I simply added:
xmlns:yt="http://gdata.youtube.com/feeds/api/videos/ADos_xW4_J0"
To the
And then also added the prefix "yt" to the exclude-result-prefixes attribute :) and then used <xsl:value-of select = "*[local-name()='location']" disable-output-escaping="yes" />
:)
What I was trying to tell you was that because you have declared the prefix (with xmlns:yt="...") you can (and should) use the full qualified name (yt:location) to access the element. It's that simple, and exactly how you do namespace stuff in XSLT.
/Chriztian
is working on a reply...