• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java in XSLT

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my xml file:
<users>
<user>
<username>mshelly</username>
<password>msh9568745</password>
<person sex="male">
<title>Mr</title>
<lastname>Shelly</lastname>
<firstname>Misho</firstname>
<nationality>Australian</nationality>
<birthdate>1971-11-01</birthdate>
</person>
<email>mshelly@mymail.com</email>
<mobile>+61356986475631</mobile>
<fax>+6145821255858</fax>
<address>
<home>
<country>Australia</country>
<city>Sydney</city>
<street>GreenMile</street>
<number>17</number>
<postalcode>658</postalcode>
</home>
<work>
<country>Australia</country>
<city>Hobart</city>
<street>West Bird</street>
<number>3</number>
<postalcode>654</postalcode>
</work>
</address>
<preference>None</preference>
</user>....................
And this is my xslt file :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Personal Information</h2>
<table border="2">
<tr bgcolor="#009995557">
<th>username</th>
<th>lastname</th>
<th>firstname</th>
<th>mail</th>
<th>mobile</th>
<th>fax</th>
</tr>
<xsl:for-each select="users/user/person[starts-with(lastname,'Iva')]/..">
<xsl:sort select="username"/>
<tr>
<td><xsl:value-of select="username"/></td>
<td><xsl:value-of select="person/lastname"/></td>
<td><xsl:value-of select="person/firstname"/></td>
<td><xsl:value-of select="email"/></td>
<td><xsl:value-of select="mobile"/></td>
<td><xsl:value-of select="fax"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

How can I replace this "<xsl:for-each select="users/user/person[starts-with(lastname,'Iva')]/..">" with some java code so that when I type from the output some string it will find the correct user by this string?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why Java code? Why not just pass the desired string to the transform as a parameter?
 
Monika Nencheva
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the answer. Well, because I have to adapt a Java program to it. And I don't know exactly how to do it.
Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic