Hi,
Well, it's not that it doesn't work, rather I can't get it work and this
has been driving me nuts for two weeks (on and off). I must be missing
something obvious, but I can't figure out what it is. Anyway, here's the
problem:
When the following asp is executed, it reports the size of the nodeset as
zero, but if I strip out all html and simply run this as a perl script
(also included below) off
a command line, I get 1, just as I would expect. I'm using ASP v.2.03 and
Xpath v.098. Any ideas what's going on? Matt, Joshua...?
----- ASP:
<%@language="PerlScript"%>
<%
use XML::XPath;
my ($xform,$xform_xpath, $xml);
%>
<html>
<head>
<%
my $data = <<"END_XML";
<!DOCTYPE xxform [
<!ATTLIST string name ID #REQUIRED>
<!ATTLIST group name ID #REQUIRED>
]>
<xxform xmlns="http://www.w3.org/2000/xforms"
action="http://www.my.com/cgi-bin/receiver.pl"
method="post"
id="po_xform">
<model>
<group name="purchaseOrder">
<group name="shipTo">
<string name="name"/>
<string name="street"/>
<string name="city"/>
<string name="state"/>
<string name="zip">
<mask>ddddd</mask>
</string>
</group>
</group>
</model>
</xxform>
END_XML
%>
</head>
<body>
<h1>Form (using XML::XPath v.<%=$XML::XPath::VERSION%>)</h1>
<pre>
<%
my $xform = new XML::XPath( xml=>$data );
my $nodeSet = $xform->find( q(id('city')) );
$Response->Write( "Size: " . $nodeSet->size . "<BR>" );
%>
</pre>
</body>
</html>
--- SCRIPT:
#!/usr/bin/perl
use XML::XPath;
my ($xform,$xform_xpath, $xml);
my $data = <<"END_XML";
<!DOCTYPE xxform [
<!ATTLIST string name ID #REQUIRED>
<!ATTLIST group name ID #REQUIRED>
]>
<xxform xmlns="http://www.w3.org/2000/xforms"
action="http://www.my.com/cgi-bin/receiver.pl"
method="post"
id="po_xform">
<model>
<group name="purchaseOrder">
<group name="shipTo">
<string name="name"/>
<string name="street"/>
<string name="city"/>
<string name="state"/>
<string name="zip">
<mask>ddddd</mask>
</string>
</group>
</group>
</model>
</xxform>
END_XML
print "using XML::XPath v.$XML::XPath::VERSION\n";
my $xform = new XML::XPath( xml=>$data );
my $nodeSet = $xform->find( q(id('city')) );
print( "Size: " . $nodeSet->size . "\n" );