Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi!
Im trying to do the following:
<?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" 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="utubexml" select="umbraco.library:GetXmlDocumentByUrl('http://gdata.youtube.com/feeds/api/channels?q=dog;v=2')"/><xsl:for-each select="$utubexml/*[local-name()='feed']/*[local-name()='entry']"> <xsl:value-of select="*[local-name()='id']" disable-output-escaping="yes" /> <hr/> </xsl:for-each></xsl:template></xsl:stylesheet>
But for some reason it doesnt work...does anyone know what I'm doing wrong?
Thanks in advance!
and if I get this right.. xslt cant use the following url:
gdata.youtube.com/feeds/api/channels?q=dog&v=2
since the & is causeing some problems..so is the thing that Im doing above even correct?
Have you tried URL encoding the the ampersand, e.g:
gdata.youtube.com/feeds/api/channels?q=dog&v=2
See if that does the trick!
If you still don't get any content when you have tried the suggestion of Tim could you please try to make a textarea in, which you write the content of your variable?
Like this:
<textarea><xsl:copy-of select="$utubexml" /></textarea>
This should give you the XML structure, which should make it fairly easy to figure out how to match it.
/Jan
Hi Inx51,
It's the age-old gotcha of XML namespaces... you need to reference them explictally in your XSLT.
See here for an example: http://our.umbraco.org/forum/developers/xslt/8016-getXMLDocument-won't-display-any-content
I'll post an example XSLT if I have time.
Cheers, Lee.
... so, instead of going crazy with all those "local-name()" functions, lets look at doing it a better way.
Since the <feed> has an Atom namespace (xmlns), you'll need to reference that in your XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
When you then grab the XML (by URL), you can use the "atom" namespace instead of the "local-name()" functions:
<xsl:variable name="utubexml" select="umbraco.library:GetXmlDocumentByUrl('http://gdata.youtube.com/feeds/api/channels?q=dog&v=2')"/> <xsl:for-each select="$utubexml/atom:feed/atom:entry"> <xsl:value-of select="atom:title" disable-output-escaping="yes" /> <hr/> </xsl:for-each>
Namespaces can be confusing, trust me - I spend many hours/days bashing my head against a wall with this stuff!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
get values from youtubefeed?
Hi!
Im trying to do the following:
<?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"
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="utubexml" select="umbraco.library:GetXmlDocumentByUrl('http://gdata.youtube.com/feeds/api/channels?q=dog;v=2')"/>
<xsl:for-each select="$utubexml/*[local-name()='feed']/*[local-name()='entry']">
<xsl:value-of select="*[local-name()='id']" disable-output-escaping="yes" />
<hr/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But for some reason it doesnt work...does anyone know what I'm doing wrong?
Thanks in advance!
and if I get this right.. xslt cant use the following url:
gdata.youtube.com/feeds/api/channels?q=dog&v=2
since the & is causeing some problems..so is the thing that Im doing above even correct?
Have you tried URL encoding the the ampersand, e.g:
gdata.youtube.com/feeds/api/channels?q=dog&v=2
See if that does the trick!
If you still don't get any content when you have tried the suggestion of Tim could you please try to make a textarea in, which you write the content of your variable?
Like this:
<textarea>
<xsl:copy-of select="$utubexml" />
</textarea>
This should give you the XML structure, which should make it fairly easy to figure out how to match it.
/Jan
Hi Inx51,
It's the age-old gotcha of XML namespaces... you need to reference them explictally in your XSLT.
See here for an example: http://our.umbraco.org/forum/developers/xslt/8016-getXMLDocument-won't-display-any-content
I'll post an example XSLT if I have time.
Cheers, Lee.
... so, instead of going crazy with all those "local-name()" functions, lets look at doing it a better way.
Since the <feed> has an Atom namespace (xmlns), you'll need to reference that in your XSLT:
When you then grab the XML (by URL), you can use the "atom" namespace instead of the "local-name()" functions:
Namespaces can be confusing, trust me - I spend many hours/days bashing my head against a wall with this stuff!
Cheers, Lee.
is working on a reply...