xml - XSLT 2.0 loop over array select elements by attribute -


i have xml file want transform saxon-ce xslt 2.0 processor:

<books>     <book name="book1">     <book name="book2">     <book name="book3"> </books> 

i want filter xml file array. array result of selected checkboxes of webpage , passed xslt setparameter:

$("input:checkbox[id='books']" ).each(function() {                books.push($(this).val());     });  //books: ["book1", "book2"]   xslt = saxon.requestxml("xsltfile.xsl"); xml = saxon.requestxml("xmlfile.xml"); var xsltproc = saxon.newxslt20processor(xslt);   xsltproc.setparameter(null, "books", books); 

now want select books name occurs in array.

xslt:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">  <xsl:param name="books"></xsl:param> <xsl:variable name="mybooks" select="/books/book[@name=$param[1]]"/>     </xsl:stylesheet> 

how can loop on array , select books name of array?

in case of

<xsl:param name="books"></xsl:param> <xsl:variable name="mybooks" select="/books/book[@name=$param]"/> 

you need

<xsl:param name="books"></xsl:param> <xsl:variable name="mybooks" select="/books/book[@name=$books]"/> 

other don't see wrong in code , according http://saxonica.com/ce/user-doc/1.1/index.html#!api/xslt20processor/setparameter parameter value can javascript array, interaction between javascript , xslt works.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -