Hi,<br><br>I am writing a www bot that gets xml from a website that includes a xsl stylesheet to apply to the xml to give html. Browsers seem to do this for us when browsing the site. WWW::Mechanize does not seem to.  I wrote some code but hit a conundrum.  How do I get the url of the xsl from the xml content, fetch it via http and apply it to the xml using XML::LibXSLT?<br>
<br>Hi, Thanks for the reply.  I realized that I need libxslt. But unless I am missing something I don&#39;t see how to pull the xsl uri out of the xml and feed it to libxslt (XML::LibXSLT).  That is my problem.<br><br>the xml starts with:<br>
<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;/something.xsl&quot;?&gt;<br><br>&lt;page&gt;<br><br>...<br><br>&lt;/page&gt;<br><br>Maybe I should just grep through the xml to find the stylesheet?  Maybe I feed XML::LibXSLT a URL?  Maybe I just feed the xml to XML::LibXSLT and it fetches the XSL stylesheet automagically?  I don&#39;t know. I have not been able to figure out more than what I have below from the docos and examples.<br>
<br>Can you help me?  Thanks,  Ben Marsh <br><br>Here is my code:<br>&lt;code&gt;<br>use lib qw|/home/blm/perl/lib|;<br><br>use strict;<br><br>use WWW::Mechanize;<br>use XML::LibXML;<br>use XML::LibXSLT;<br><br>my $mech = WWW::Mechanize-&gt;new(agent =&gt; &#39;Mozilla/5.0 (X11; U; Linux i686; en-US;+ rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1&#39; );<br>
<br>my $url = &#39;<a href="https://some.url.here/">https://some.url.here/</a>&#39;;<br>$mech-&gt;delete_header(&#39;accept-encoding&#39;);<br>$mech-&gt;get($url);<br><br>$mech-&gt;update_html($mech-&gt;content());<br><br>
print $mech-&gt;content;<br>my $parser = XML::LibXML-&gt;new();<br>my $style_parser = XML::LibXML-&gt;new();<br>my $xslt = XML::LibXSLT-&gt;new();<br><br>my $doc = $parser-&gt;parse_string($mech-&gt;content());<br>print $doc-&gt;toString();<br>
my $stylesheet_location =                                            ***Here is my problem***<br>$mech-&gt;get($stylesheet_location);<br>my $stylesheet_string = $mech-&gt;content();<br>my $styledoc = $style_parser-&gt;parse_string($stylesheet_string);<br>
my $stylesheet = $xslt-&gt;parse_stylesheet($styledoc);<br>my $results = $xslt-&gt;transform($doc);<br>print $results;<br>