I'm trying use ends-with in xslt for return any values. for example: I've this xml:
<BOOKS>
<BOOK>
<TITLE>title1</TITLE>
<ISSN>12313213</ISSN>
</BOOK>
<BOOK>
<TITLE>title2</TITLE>
<ISSN>67895776</ISSN>
</BOOK>
<BOOK>
<TITLE>title3</TITLE>
<ISSN>54363645</ISSN>
</BOOK>
</BOOKS>
and this static xml(book.xml):
<BOOKS>
<BOOK>
<VALUE>test title12</VALUE>
<PRICE>1235,23</PRICE>
</BOOK>
<BOOK>
<VALUE>test title1</VALUE>
<PRICE>345,23</PRICE>
</BOOK>
</BOOKS>
I need to verify if there's a book title in title xml. My code:
<xsl:template match="/">
<xsl:variable name="book" select="document('file:///E:/book.xml')"/>
<BOOKS>
<xsl:for-each select="$book/books/book">
<xsl:variable name="value" select="VALUE"/>
<xsl:variable name="price" select="ESTRATO"/>
<xsl:for-each select="//BOOKS">
<xsl:for-each select="BOOK">
<xsl:if test="ends-with($value, @TITLE)">
<BOOK>
<TITLE><xsl:value-of select="@TITLE"/></TITLE>
<ISSN><xsl:value-of select="$value"/></ISSN>
<PRICE><xsl:value-of select="$price"/></PRICE>
</BOOK>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</BOOKS>
</xsl:template>
I wanna return when the book title ends-with in the tag VALUE in the xml books. Can anyone Help me? Thanks.
I've tried to use something like that How to use contains in xslt? but doesn't worked.