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 7986735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:56:19+00:00 2026-06-04T11:56:19+00:00

I have an XML catalog data and an XSL file to visualize this catalog

  • 0

I have an XML catalog data and an XSL file to visualize this catalog data. I use this line to validate XML.

<?xml-stylesheet type="text/xsl" href="presentation-list-catalog.xsl"?>

This part works great.

I’d like to have a secret link for designers, or somehow I need to validate XML using another XSL file. Basically I need to only change the link to the XSL file:

<?xml-stylesheet type="text/xsl" href="download-links-catalog.xsl"?>

This XSL file is another visualisation of the XML catalog data so that designers will be able to download hi-res catalog pictures. For this purpose, I would like to use the same XML, but converted using another custom XSL file.

Is it possible to specify a custom XSL file using an HTTP request like:

http://example.com/catalog.xml?download-links-catalog.xsl

What are the possible solutions?

  • 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-06-04T11:56:20+00:00Added an answer on June 4, 2026 at 11:56 am

    If you’re using PHP, one solution is the following:

    Have catalog.xml point to a PHP file that serves up the correct XSL file based on the referral URL.

    You can port this idea to other server-side scripts, such as Ruby, ASP, JSP, etc.

    catalog.xml

    In catalog.xml, instead of pointing to an XSL file, point to a PHP file. In this example, the PHP file is catalog.php.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="catalog.php"?>
    <catalog>
      <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
      </cd>
    </catalog>
    

    catalog.php

    catalog.php serves up the correct XSL file based upon the referral URL.

    <?php
    // Output the correct Content-Type, so that browsers know 
    // to treat this file as an XSL document
    header("Content-Type: text/xsl; charset=utf-8");
    
    // Example $referer: http://example.com/catalog.xml?download-links-catalog.xsl
    $referer = parse_url($_SERVER['HTTP_REFERER']);
    
    // Example $query: download-links-catalog.xsl
    $query = $referer['query'];
    
    // If the file exists, serve up $query.
    // If not, serve up the default presentation-list-catalog.xsl.
    $xslFile = file_exists($query) ? $query : "presentation-list-catalog.xsl";
    echo file_get_contents($xslFile);
    ?>
    

    For brevity, this example doesn’t include some security checks. For example, you should validate that $query is in actuality an XSL file. If this check isn’t made, then hackers could access arbitrary files on your server.

    presentation-list-catalog.xsl

    There’s nothing strange about this XSL file. Note that the text within the h2 tags is Presentation List Catalog.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html>
      <body>
      <h2>Presentation List Catalog</h2>
      <table border="1">
        <tr bgcolor="#9acd32">
          <th>Title</th>
          <th>Artist</th>
        </tr>
        <xsl:for-each select="catalog/cd">
        <tr>
          <td><xsl:value-of select="title"/></td>
          <td><xsl:value-of select="artist"/></td>
        </tr>
        </xsl:for-each>
      </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    

    download-links-catalog.xsl

    This XSL file is the same as presentation-list-catalog.xsl except that the text within the h2 tags is Download Links Catalog.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
      <html>
      <body>
      <h2>Download Links Catalog</h2>
      <table border="1">
        <tr bgcolor="#9acd32">
          <th>Title</th>
          <th>Artist</th>
        </tr>
        <xsl:for-each select="catalog/cd">
        <tr>
          <td><xsl:value-of select="title"/></td>
          <td><xsl:value-of select="artist"/></td>
        </tr>
        </xsl:for-each>
      </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
    

    What to Expect

    Using the above setup, navigating to http://example.com/catalog.xml
    will serve up catalog.xml using presentation-list-catalog.xsl.

    Navigating to http://example.com/catalog.xml?download-links-catalog.xsl
    will serve up catalog.xml using download-links-catalog.xsl.

    The example XML and XSL files above were taken from W3Schools’s article on “XSLT – Transformation.”

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

Sidebar

Related Questions

In this the catalog.xml file. I have two books who have the same inventory
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
I have an XML file: <Org href=https://vcloudserver/api/v1.0/org/272521719 type=application/vnd.vmware.vcloud.org+xml name=blah-blah xmlns=http://www.vmware.com/vcloud/v1> <Link href=https://vcloudserver/api/v1.0/vdc/1093121285 type=application/vnd.vmware.vcloud.vdc+xml name=blah-haha
Is there a way to have Artifactory automatically generate the archetype-catalog.xml file for a
I have an XML file. <?xml version=1.0?> <catalog> <book id=bk101> </book> <catalog> I read
I have an XML file with this format: <?xml version=1.0 encoding=utf-8 ?> <OpacResult> <valueObjects
I have an XML file with this format: <?xml version=1.0 encoding=utf-8 ?> <OpacResult> <valueObjects
Taking the XSLT and XML from this page as an example: http://www.w3schools.com/xsl/xsl_transformation.asp I have
I have the following code for my grid (I use an XML file in
Hi i added this to catalog.xml layout definition: <reference name=head> <action method=addCss><stylesheet>css/local.css</stylesheet></action> </reference> and

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.