Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2011, 02:23 PM
Registered User
 
Join Date: May 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loading url

Hi,
I am very new to programming, and I have this problem - I want to load url from xml, and use it as a link on page created via xsl. After some not so short time spent on finding way to do it I have finally manged to, but it occurs that this little bastard adds "/" at the end of my url, making it utterly useless :/

for example: url is <link>whatever1.xml</link>, and after xsl-magic my browser really want to open "whatever1.xml/", which obviously does not make me happy :/

Sorry for exotic names, and thanks in advance for help.

Here's my xml:
Code:
?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="transformacja.xsl"?>
<katalog>
    <ryba>
    <nazwa>Ryba 1</nazwa>
    <latin>Pisces 1</latin>
    <link>ryby/ryba1.xml/</link>
</ryba>
</katalog>
And here is my xsl

Code:
<?xml version="1.0" standalone="no"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <html>
      <head>
        <title>Atlas Ryb - Indeks</title>
        <style type="text/css">
          body
          {
          margin:10px 10px 10px 10px;
          background-image:url('images/01.jpg');
          color: #5F8700;
          text-align: justify;
          font-family: Georgia, "Times New Roman", Times, serif;
          font-weight: normal;
          letter-spacing: -1px;
          font-size: 1.0em;
          }
        </style>
      </head>
      <body>
        <center>
          <img src="images/ObrazekIndeks.gif"/>
          <h2>XXXXXXXXXXXXXXXXXXX</h2>
          <p>YYYYYYYYYYYYYYYYY</p>
          
          <table style="width:80%;" border="0">
            <tr>
              <td width="33,33%" align="center">dfhg</td>
              <td width="33,33%" align="center">sdfg</td>
              <td width="33,33%" align="left">sdfg</td>
            </tr>
          </table>
          
          <xsl:apply-templates/>
        </center>
      </body>
    </html>
  </xsl:template>

  
  
  <xsl:template match="katalog">
    <xsl:for-each select="ryba">
      <xsl:sort select="nazwa"/>
      <table style="width:80%;" border="0">
        <tr>
          <td width="33,33%" align="center">
            <xsl:value-of select="nazwa"/>
          </td>
          <td width="33,33%" align="center">
            <xsl:value-of select="latin"/>
          </td>
          <td width="33,33%" align="left">
          <a>
        <xsl:attribute name="href">
          <xsl:value-of select="link"/>
        </xsl:attribute>Zobacz
      </a>
          </td>
        </tr>
      </table>
    </xsl:for-each>
    <a href="niewiemco.xml">
      <p>Zobacz wszystkie ryby</p>
    </a>
  </xsl:template>

</xsl:stylesheet>
 
Old May 18th, 2011, 05:54 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Very often if a "/" appears magically at the end of a URL, it's because the web server itself issued a redirection request: that is, you asked for "abc.xml", and the web server replied saying please ask for "abc.xml/" instead; so "abc.xml/" is what appears in the browser address bar. If the redirected address doesn't work, then the server seems to be misconfigured. This is nothing to do with XSLT.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old May 18th, 2011, 06:06 PM
Registered User
 
Join Date: May 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many Thanks.
I've noticed that only 4 links were malformed.
Somehow, when I've re-written xml content, everything is working just fine...

Anyhow, this thread can be closed, deleted or whatever :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Redirect based on given URL somnath.kartic VS.NET 2002/2003 1 August 2nd, 2012 08:21 AM
URL rewriting with URL forwarding mtabyana BOOK: Professional Search Engine Optimization with PHP: A Dev's Guide to SEO ISBN: 978-0-470-10092-9 0 October 22nd, 2007 08:22 AM
loading form angelboy C# 2005 2 May 11th, 2007 03:11 PM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.