Copied to clipboard

Flag this post as spam?

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


  • Rick van der Zwart 8 posts 28 karma points
    Feb 27, 2013 @ 14:28
    Rick van der Zwart
    0

    How do I export Google Merchant Center's specific XML to use in XSLT?

    For an assignment in my internship, I need to be able to list all the products stored in an online XML file created with Google Merchant Center and filter them by <g:product_type>Clubteams &gt; Nederland &gt; Ajax</g:product_type>

    However, XSLT gives me an error every time I try to use any of Google's "g:something" tags, and I don't know what to do. I've tried using variables, I've tried listing the contents as raw text, I've even tried replacing the colon with a dot... Nothing I can think of seems to work.

    CLARIFICATION: I'm not yet filtering the results by g:product_type, as I first want to get the images to work. But my problem overall is that XSL just doesn't seem to be able to interpret g:something tags at all.

    My current XSLT is as follows:


    <?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="/">
      <!-- start writing XSLT -->
      <xsl:variable name="MyFeed" select="umbraco.library:GetXmlDocumentByUrl('http://shop.voetbalshirts.com/content/files/exportimport/froogle_7679424322.xml')" />
      <xsl:for-each select="$MyFeed/rss/channel/item">
              <div style="padding: 10px;">
                  <span style="font-weight:bold"><xsl:value-of select="title"/></span><br />
                  <img>
                      <xsl:attribute name="src"><xsl:value-of select="g:image_link"/></xsl:attribute>
                  </img><br />
                  <xsl:value-of select="description"/>
              </div>
      </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Does anybody know how to solve this problem?

    -Rick

  • Rick van der Zwart 8 posts 28 karma points
    Feb 27, 2013 @ 16:37
    Rick van der Zwart
    0

    UPDATE: Solved the problem myself by using the following code.

    <xsl:variable name="image" select="*[local-name()='image_link']" />
    <xsl:attribute name="src"><xsl:value-of select="$image"/></xsl:attribute>

Please Sign in or register to post replies

Write your reply to:

Draft