File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Java in XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Java in XSLT" Watch "Java in XSLT" New topic

Java in XSLT

Monika Nencheva

Joined: Jul 14, 2010
Posts: 3
This is my xml file:
<person sex="male">
<street>West Bird</street>
And this is my xslt file :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template match="/">
<h2>Personal Information</h2>
<table border="2">
<tr bgcolor="#009995557">
<xsl:for-each select="users/user/person[starts-with(lastname,'Iva')]/..">
<xsl:sort select="username"/>
<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>

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?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19692

Why Java code? Why not just pass the desired string to the transform as a parameter?
Monika Nencheva

Joined: Jul 14, 2010
Posts: 3
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.
Don't get me started about those stupid light bulbs.
subject: Java in XSLT
It's not a secret anymore!