in reply to xml::xslt xpath bug?

Don't forget to quote your values. Your code

<xsl:if test="/PLMXML/Form[@id=id24]">

should be

<xsl:if test="/PLMXML/Form[@id='id24']">

Unquoted would try to find a child element named id24. (Well, it's suppose to. I don't have much faith in XML::XSLT.)

Both single and double quotes are equivalent in XPaths. Don't forget to appropriately escaped them according to the enclosing quotes.

<xsl:if test="/PLMXML/Form[@id='id24']"> <xsl:if test='/PLMXML/Form[@id="id24"]'> <xsl:if test="/PLMXML/Form[@id=&quot;id24&quot;]"> <xsl:if test='/PLMXML/Form[@id=&apos;id24&apos;]'>

Replies are listed 'Best First'.
Re^2: xml::xslt xpath bug?
by Anonymous Monk on Jul 07, 2009 at 15:48 UTC
    Which Perl Module would you recommend I use to get this done? I tried each of the suggested forms and each returned an unexpected element.
    <xsl:for-each select='/PLMXML/Form[@id=&apos;id24&apos;]'> <xsl:value-of select="@id"/> </xsl:for-each> returns: id36 <xsl:for-each select="/PLMXML/Form[@id=&quot;id24&quot;]"> <xsl:value-of select="@id"/> </xsl:for-each> returns: id36 <xsl:for-each select='/PLMXML/Form[@id="id24"]'> <xsl:value-of select="@id"/> </xsl:for-each> returns: id36 <xsl:for-each select="/PLMXML/Form[@id='id24']"> <xsl:value-of select="@id"/> </xsl:for-each> returns: id36
      Sorry, I can't make a recommendation. I've never used XSLT.
        Okay, a more general question. What Perl Module(s) would you use to get bits of information out of an xml file and put them into an Excel file? I tried XML::Parser but found it dropped lots of data when it read xml into an array (and I had the same problem when I tried read xml into a hash).