Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6049643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:35:59+00:00 2026-05-23T07:35:59+00:00

I have tried several things to get it work. Here is my problem. I

  • 0

I have tried several things to get it work.

Here is my problem.

I have this XML content

<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecordByIdResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
  <csw:Record xmlns:dct="http://purl.org/dc/terms/" xmlns:ows="http://www.opengis.net/ows" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <dc:identifier>b6ebec90-96ac-477f-bfcf-ccef920e3e99</dc:identifier>
  <dc:title>Physiographic Map of North and Central Eurasia (Sample record, please remove!)</dc:title>
  <dct:abstract>Physiographic maps ... </dct:abstract>
  <dc:rights>copyright</dc:rights>
  <dc:language />
  <dc:source />
  <ows:BoundingBox crs="urn:ogc:def:crs:::Lambert Azimuthal Projection">
    <ows:LowerCorner>156 -3</ows:LowerCorner>
    <ows:UpperCorner>37 83</ows:UpperCorner>
  </ows:BoundingBox>
  <dc:URI protocol="image/gif" name="thumbnail">resources.get?id=14&amp;fname=phy_s.gif&amp;access=public</dc:URI>
  </csw:Record>
</csw:GetRecordByIdResponse>

and I’m trying to use the value of <dc:URI protocol="image/gif" name="thumbnail">resources.get?id=14&amp;fname=phy_s.gif&amp;access=public</dc:URI> as the src of an img tag.

Note that the value in the XML is encoded (& instead of &)

Here’s the xsl I use to transform the XML to HTML

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:geonet="http://www.fao.org/geonetwork"
xmlns:ows="http://www.opengis.net/ows"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:fn="http://www.w3.org/2005/xpath-functions"   >

<xsl:output method="html" encoding="UTF-8" indent="yes" />
<xsl:template match="csw:GetRecordByIdResponse">
    <html>
        <head>
            <meta charset="utf-8" />
        </head>
        <body>
                <xsl:apply-templates select="csw:Record" />
        </body>
    </html>
</xsl:template>

<xsl:template match="csw:Record">
    <h1><xsl:value-of select="dc:title" /><span class='identifier'><xsl:value-of select="dc:identifier" /></span></h1>
    <p class='description'><xsl:value-of select="dc:title" /></p>
    <ul>
        <xsl:for-each select="dc:URI">
            <xsl:if test="@name = 'thumbnail'">
                <li>
                    <xsl:value-of select="." disable-output-escaping="yes" />               
                    <xsl:element name="img">
                        <xsl:attribute name="src"><xsl:text>http://localhost:8080/geonetwork/srv/en/</xsl:text><xsl:value-of select="." disable-output-escaping="yes" /></xsl:attribute>
                    </xsl:element>  
                </li>
            </xsl:if>
        </xsl:for-each>
    </ul>
</xsl:template>

I’m using PHP to process it

<?php
$xp = new XsltProcessor();
// create a DOM document and load the XSL stylesheet
$xsl = new DomDocument;
$xsl->load('sample.xsl');

// import the XSL styelsheet into the XSLT process
$xp->importStylesheet($xsl);

$xml_doc = new DomDocument;
$xml_doc->loadXML(file_get_contents('sample.xml'));
// transform the XML into HTML using the XSL file
if ($html = $xp->transformToXML($xml_doc))
    echo $html;
?>

I’m still getting this output … <li>resources.get?id=14&fname=phy_s.gif&access=public<img src="http://localhost:8080/geonetwork/srv/en/resources.get?id=14&amp;fname=phy_s.gif&amp;access=public">
</li>
… Note that the value in the src attribute still has &amp; while the other one his outputting correctly &.

Thanks in advance,
Jack

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:35:59+00:00Added an answer on May 23, 2026 at 7:35 am

    Note that the value in the href attribute still has &amp; while the other one his outputting correctly &.

    No, the correct and required writing is &amp; in href attributes within the output. I’m lazy in typing, for an explanation see the question Remove &amp from string when writing to xml in PHP and particulary this answer.

    Even the other one of which you wrongfully thought it’s correct (&) must be written as &amp; correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is what I have. I have tried several things but I can't figure
I have spent the last several hours trying to get this to work and
I have spent several hours on this, and tried various things. I can confirm
I have tried several things but I can't get the MySQL query in my
I have tried several things so far, but I haven't had much luck yet.
I have tried this question on the site of Titanium and several tweets to
I'm having this problem for a while now. I tried so many things that
I have tried several ways to login to a website through java. I have
I really need advice on how to do the following. I have tried several
I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item(Post), \b\#\b) But it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.