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
Im trying to get the sitemap of an external page so that i can return it within umbraco.Is it enough to add the:
<?xe.target ..domain.com/user.xml?user=77765&return=xml&per_page=1000?>
at the 2nd line or is there more to it? (i guess there is since it isnt working atm).Ive been looking through w3school and google and somehow i can't find anything usefull to me regarding linking to an external xml file.
The code as it is now (there is hardly any)
<?xml version="1.0" encoding="UTF-8"?><?xe.target ..http://www.domain.com/user.xml?user=5555&return=xml&per_page=100?><xsl:stylesheetversion="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="/"> <xsl:for-each select="listings/listing"> <xsl:value-of select="description"/> </xsl:for-each> </xsl:template></xsl:stylesheet>
Thanks in advance
Hi Martin,
Adding the xs.target processing instruction won't do anything in Umbraco, but there's an extension function available for you:
<xsl:variablename="feed"select="umbraco.library:GetXmlDocumentByUrl('http://www.domain.com/user.xml?user=5555&return=xml&per_page=100', 300)"/>
(the second argument is the number of seconds Umbraco should cache the result)
Then you'd change the for-each to grab from that variable (making sure to select from the root):
<xsl:for-eachselect="$feed/listings/listing">
/Chriztian
thanks alot for your response
and i see the logic in that. Though i get an error now regarding the URL.Seems as if the return=xml statement in the link is causing an error.
System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 12, position 120.
/Martin
My bad - copy & paste error :-)
In XML (and HTML too, actually) you have to escape ampersands (&) like this: &
I've corrected the code above.
Hi Chriztian i was just about to post the same :)
Thanks again.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Rookie: XML external sitemap in Unbraco Xslt
Im trying to get the sitemap of an external page so that i can return it within umbraco.
Is it enough to add the:
at the 2nd line or is there more to it? (i guess there is since it isnt working atm).
Ive been looking through w3school and google and somehow i can't find anything usefull to me regarding linking to an external xml file.
The code as it is now (there is hardly any)
<?xml version="1.0" encoding="UTF-8"?>
<?xe.target ..http://www.domain.com/user.xml?user=5555&return=xml&per_page=100?>
<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="/">
<xsl:for-each select="listings/listing">
<xsl:value-of select="description"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Thanks in advance
Hi Martin,
Adding the xs.target processing instruction won't do anything in Umbraco, but there's an extension function available for you:
(the second argument is the number of seconds Umbraco should cache the result)
Then you'd change the for-each to grab from that variable (making sure to select from the root):
/Chriztian
thanks alot for your response
and i see the logic in that. Though i get an error now regarding the URL.
Seems as if the return=xml statement in the link is causing an error.
System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 12, position 120.
/Martin
Hi Martin,
My bad - copy & paste error :-)
In XML (and HTML too, actually) you have to escape ampersands (&) like this: &
I've corrected the code above.
/Chriztian
Hi Chriztian i was just about to post the same :)
Thanks again.
is working on a reply...