Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>According to <a href="http://www.w3.org/TR/2006/REC-xml-names-20060816/#scoping-defaulting" rel="nofollow noreferrer">http://www.w3.org/TR/2006/REC-xml-names-20060816/#scoping-defaulting</a></p> <p>"Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear."</p> <p>This means that your attributes aren't in a namespace. Just use "@term". </p> <p>Just to be a bit clearer, there is no need for using local-name() to solve this problem. The conventional way to deal with it would be to declare a prefix for the atom namespace in your XSLT, and then use that in your xpath queries. </p> <p>You have already got this declaration on your stylesheet element (xmlns:atom="http://www.w3.org/2005/Atom"), so all that remains is to use it. </p> <p>As I have already explained, the attribute is not affected by the default namespace, so your code would look like this (assuming that you were to add "xmlns:xhtml='<a href="http://www.w3.org/1999/xhtml" rel="nofollow noreferrer">http://www.w3.org/1999/xhtml</a>'"): </p> <pre><code> &lt;xsl:for-each select="/atom:feed/atom:entry"&gt; &lt;xsl:variable name="CurrentVenueKey" select="atom:id" /&gt; &lt;xsl:variable name="CurrentVenueName" select="atom:title" /&gt; &lt;xsl:variable name="CurrentVenueAddress1" select="atom:content/xhtml:div/xhtml:div/xhtml:p[@class='adr']/xhtml:span[@class='street-address']" /&gt; &lt;xsl:variable name="CurrentVenueCity" select="atom:content/xhtml:div/xhtml:div'/xhtml:p[@class='adr']/xhtml:span[@class='locality'] /&gt; ... &lt;xsl:variable name="CurrentCategory" select="atom:category/@term" /&gt; ..... </code></pre> <p>local-name() can be very useful if you really don't know the structure of the XML you are transforming, but in this case, if you receive anything other than what you're expecting, it will break in any case. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload