foo.pl:
#!/usr/bin/perl use strict; use warnings; use XML::XSLT qw( ); use Object::Destroyer qw( ); my $xslt = Object::Destroyer->new( XML::XSLT->new('foo.xslt', warnings => 1), 'dispose', ); $xslt->transform('foo.xml'); print $xslt->toString;
foo.xml:
<?xml version="1.0" encoding="utf-8"?> <PLMXML xmlns="http://www.plmxml.org/Schemas/PLMXMLSchema"> <Form id="id24" subType="Part Revision Master"> <UserData> <UserValue title="cage_code" value="98747"/> </UserData> </Form> </PLMXML>
foo.xslt:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr +ansform"> <xsl:template match="/"> <xsl:value-of select="/PLMXML/Form[@subType='Part Revision Master']/Us +erData/UserValue[@title='cage_code']/@value"/> </xsl:template> </xsl:stylesheet>
Also tried:
Works: "/PLMXML/Form[@id='id24']/UserData/UserValue[@title='cag +e_code']/@value" Doesn't work: "/PLMXML/Form[@subType='Part Revision Master']" Doesn't work: "/PLMXML/Form[@subType="Part Revision Master"] +/UserData/UserValue[@title='cage_code']/@value"
(This should have been in your original post)
In reply to Re^5: xml::xslt xpath question (problem)
by ikegami
in thread xml::xslt xpath question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |