How can I search an XML file without a dynamic language?

Posted by jeph perro on Stack Overflow See other posts from Stack Overflow or by jeph perro
Published on 2011-01-14T00:24:14Z Indexed on 2011/01/14 2:53 UTC
Read the original article Hit count: 326

Filed under:
|
|
|

Let me try to explain my situation:

We are using a CMS which 'bakes' a website, and you publish it to a webserver. The published site contains only static HTML ( or XML ) pages ( generated from the content in the CMS database ).

I imported an XML file with the names and phone numbers from the company phone directory.

Using only XSLT, can I create a way to search that directory?

For example, if my XML file, directory.xml looks like this:

<directory>
<person>
 <fname>Ryan</fname>
 <lname>Purple</lname>
  <phone>887 778 5544</phone>
</person>
<person>
  <fname>Tanya</fname>
  <lname>Orange</lname>
  <phone>887 998 5541</phone>
</person>
<directory>

Can I create a way to search for a person with the last name starting with "Pur" ?

  1. Can I pass a parameter to the XSLT?

  2. Can I search the XML tree to match the string in the parameter?

© Stack Overflow or respective owner

Related posts about html

Related posts about Xml