Jsp+xslt+xml

hi,
I want to display the xml file which is as following:
<item>
<title>title1</title>
<content>content1</content>
</item>
<item>
<title>title2</title>
<content>content2</content>
</item>
I want to display all titles in a table. When clicking a title, then displaying the corresponding content.
So I wrote code:
<xsl:for-each select="title">
<a>
<xsl:attribute name="href">content.jsp</xsl:text></xsl:attribute>
<xsl:apply-templates />
</a>
</xsl:for-each>
How can i transfer the title name to the content.jsp so that the corresponding content can be handled in content.jsp?
Any suggestion is helpful.

Hi jacky_chenp,
I am facing a problem in JSP + XSLT + XML, just see whether you can help as I am new to it.
I am getting the following error message while try to compile JSP_Book_Inventory.jsp
Error: java.security.PrivilegedActionException <<java.lang.ClassNotFoundException: org.apache.xalan.xslt.XSLTInputSource>>
JSP_Book_Inventory.jsp
<%@ taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xsl" %>
<html>
<head><title>Book Inventory</title></head>
<body>
<xsl:apply xml="XML_Book_Inventory" xsl="XSL_Book_Inventory.xsl" />
</body>
</html>
XML_Book_Inventory.xml
<?xml version='1.0' encoding='ISO-8859-1'?>
<books>
<book isbn="123">
<title>Web Servers for Fun and Profit</title>
<quantity>10</quantity>
<price>$17.95</price>
</book>
<book isbn="456">
<title>Web Programming for Mobile Devices</title>
<quantity>2</quantity>
<price>$38.95</price>
</book>
<book isbn="789">
<title>Duke: A Biography of the Java Evangelist</title>
<quantity>25</quantity>
<price>$15.00</price>
</book>
</books>
XSL_Book_Inventory.xsl
<?xml version='1.0' encoding='windows-1252'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Root template -->
<xsl:template match="books">
<table border="1" width="100%">
<th>ISBN</th>
<th>Title</th>
<th>Quantity</th>
<th>Price</th>
<xsl:for-each select="book">
<tr>
<td><xsl:value-of select="@isbn" /></td>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="quantity" /></td>
<td><xsl:value-of select="price" /></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Thank you.

Similar Messages

  • How to pass parameters to an XSL for use in a transform (JSP/XSLT)?

    I have an XSL: style.xsl
    I have an XML: data.xml
    I want to do an XSL Transform on data.xml, using style.xsl, with parameter
    Language=en
    With Saxon you would do:
    saxon data.xml style.xsl Language=en
    But how would I do this with WL6.x, using the JSP XSLT tag:
    <x:xslt [xml="uri of XML file"]
    [media="media type to determine stylesheet"]
    [stylesheet="uri of stylesheet"]
    <x:xml>In-line XML goes here
    </x:xml>
    <x:stylesheet [media="media type to determine stylesheet"]
    [uri="uri of stylesheet"]
    </x:stylesheet>
    </x:xslt>
    Thanks
    Alain Jacquot

    There is currently no way to do this from the jsp xslt tag. I have filed an
    issue because this is available in the JAXP 1.1 API. If you need this
    functionality in the current version you will need to use the JAXP API
    directly.
    Sam
    "Alain Jacquot" <[email protected]> wrote in message
    news:3b368016$[email protected]..
    I have an XSL: style.xsl
    I have an XML: data.xml
    I want to do an XSL Transform on data.xml, using style.xsl, with parameter
    Language=en
    With Saxon you would do:
    saxon data.xml style.xsl Language=en
    But how would I do this with WL6.x, using the JSP XSLT tag:
    <x:xslt [xml="uri of XML file"]
    [media="media type to determine stylesheet"]
    [stylesheet="uri of stylesheet"]
    <x:xml>In-line XML goes here
    </x:xml>
    <x:stylesheet [media="media type to determine stylesheet"]
    [uri="uri of stylesheet"]
    </x:stylesheet>
    </x:xslt>
    Thanks
    Alain Jacquot

  • Problems with JSP Documents (XML Mode)

    Hi --
    Have been following the spec for JSP as XML documents because I want to produce JSPs using XSLT. Two problems which I've yet to find anything but workarounds for:
    1. (Most pressing) JSP Documents do not allow this <%= blah %>. This creates problems when I want to dynamically create an attribute value. The spec recommends this: 'value = "%=var%"', but I've tried this in Tomcat 4.1.12 and the expression gets reproduced literally at run-time. I've searched these forums and not found an answer.
    2. Transformer wigs out on colons in "jsp:root" or "c:out" because it signifies a namespace with which it is unfamiliar. It doesn't need to recognize the namespace. Right now I'm putting in placeholders (jsp999root, for example) and replacing them after processing. Is there a better way?
    These problems are really getting in the way. Any help would be most appreciated.

    Have been following the spec for JSP as XML documents because I want to
    produce JSPs using XSLT. Two problems which I've yet to find anything but
    workarounds for:
    1. (Most pressing) JSP Documents do not allow this <%= blah %>. This creates
    problems when I want to dynamically create an attribute value. The spec
    recommends this: 'value = "%=var%"', but I've tried this in Tomcat 4.1.12 and
    the expression gets reproduced literally at run-time. I've searched these
    forums and not found an answer. I am stuck on this also and desperately searching for an answer. Has anyone found anything yet?
    2. Transformer wigs out on colons in "jsp:root" or "c:out" because it
    signifies a namespace with which it is unfamiliar. It doesn't need to
    recognize the namespace. Right now I'm putting in placeholders (jsp999root,
    for example) and replacing them after processing. Is there a better way?You can (and should) put multiple namespace declarations in the xsl:stylesheet tag. that will let it know about jsp:* and pass it through appropriately. Try something like:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:jsp="http://java.sun.com/JSP/Page">

  • JSPs as XML Documents -- Problems

    Hi --
    Have been following the spec for JSP as XML documents because I want to produce JSPs using XSLT. Two problems which I've yet to find anything but workarounds for:
    1. (Most pressing) JSP Documents do not allow this <%= blah %>. This creates problems when I want to dynamically create an attribute value. The spec recommends this: 'value = "%=var%"', but I've tried this in Tomcat 4.1.12 and the expression gets reproduced literally at run-time. I've searched these forums and not found an answer.
    2. Transformer wigs out on colons in "jsp:root" or "c:out" because it signifies a namespace with which it is unfamiliar. It doesn't need to recognize the namespace. Right now I'm putting in placeholders (jsp999root, for example) and replacing them after processing. Is there a better way?
    These problems are really getting in the way. Any help would be most appreciated.

    Hi,
    It looks from No. 2 that you are using JSLT since you have a fragment of a <c:out tag. I believe the syntax for getting the value out of one of these tags is actually almost identical to that in XSLT:
    value="${var}" instead of what you got from the spec,
    The spec recommends this: 'value = "%=var%"'The name spaces do have to be declared for JSLT to work, declared in the <jsp:root> tag:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jstl/core"
    version="1.2">
    Here's a very simple jsp that uses it:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jstl/core"
    version="1.2">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <html>
         <head>
         <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"/>
         <title>Hello World</title>
         </head>
         <body>
         <c:set var="nameString" value="John"></c:set>
         <h2>The name is: <c:out value="${nameString}"/></h2>
         </body>
    </html>
    </jsp:root>
    Of course, you have to have the tlds set up and the JSLT jars available for the compiler.
    I haven't yet tried this with transforms, but there are tags in the JSLT for that as well. If you've tried all this already, my apologies.
    Edward

  • XSLT/xml transform & jar

    In EP6 SP2 there is an XSLT/xml transform api. Can somebody tell me what jar file is it in?

    contentconversionapi.jar & contentconverterapi.jar can transform any xml file with xslt file. you can download the jar your portal install.

  • Char into balise jsp:scriptlet in jsp with xml syntax

    hello,
    i met a trouble with coding jsp with xml syntax,
    i use wsad to develop the jsp, and it's not allowed to put characters < or > into the balise scriptlet
    for example i cant do a loop (as i did easily with html syntax <% %> ) :
    this his the header of my jsp:
    <jsp:directive.page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" />
    <jsp:text>
    <![CDATA[ <?xml version="1.0" encoding="ISO-8859-1" ?> ]]>
    </jsp:text>
    <jsp:text>
    <![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ]]>
    </jsp:text>
    and the code which dont work:
    <jsp:scriptlet>
    for (int i=0;i<10;i++){
    System.out.println(i);
    </jsp:scriptlet>
    i get a compilation error, did someone could help me to code dynamic content jsp ?
    ps: excuse me for my english.

    I don't use xml, so I may be way off the wall, but did you try using the CDATA sections again?
    <jsp:scriptlet>
    <![CDATA[
    for (int i=0;i<10;i++){
    System.out.println(i);
    ]]>
    </jsp:scriptlet>

  • Diff. between JSP format & XML based syntax

    i like to know the diff. between 2 types of jsp syntax,
    JSP - 1 - ordinary
    <% code %>
    JSP - 2 - XML based syntax
    <jsp:expression> code </jsp:expression>
    what is best to use for jsp development.,

    Haven't u finished fresher course yet?

  • JSP/JSTL & XML

    I am trying to have JSP pages parse and read an XML file and then return some data in an HTML table. I'm using the JSTL libraries and have a basic understanding of them, but I apparently need help.
    My first page just gets the value and passes it to the second page. The second page handles all of the processing. Here is my JSP page:
    <%@page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <%@include file="index.jsp" %>
    <% String clientID = request.getParameter("enteredID"); %>
    <c:import url="npiXMLTest5.xml" var="doc" />
    <x:parse varDom="dom" doc="${doc}"/>
    <x:set var="srcCID" select="string($dom/npiNumbers/client/clientNum)" />
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>NPI XJTL Test</title></head>
    <body>
    <c:set var="CID" value="<%= clientID %>" />
    <h2>NPI XJTL Test Page</h2>
    <table border="1">
    <tr><th>NPI Number</th><th>Description</th></tr>
    <c:choose>
    <c:when test="${CID}=${srcCID}">
    <x:forEach select="$dom/npiNumbers/client/npiNum" var="$n">
    <tr><td><x:out select="$n/npi" /></td><td><x:out select="$n/desc" /></td></tr>
    </x:forEach>
    </c:when>
    <c:otherwise>
    There is an error with your coding
    </c:otherwise>
    </c:choose>
    </table></body></html>My XML structure is as follows:
    <npiNumbers xsi:schemaLocation="http://localhost/namespace NPI_XSD5.xsd" xmlns="http://localhost/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <client>
    <clientNum/>
    <clientName/>
    <npiNum>
    <npi/>
    <desc/>
    </npiNum>
    </client>
    </npiNumbers>I am trying to return the results of the <npiNum> element (which can have multiple values) - <npi> and <desc> - in a table based on the <clientNum> element. I try to evaluate the page variable with the xml element. If it matches, I will return a table. A client can have multiple <npiNum> elements, so the construction of the table is in the x:forEach loop.
    I think my problem is getting the variable from JSP to compare against the <clientNum> element in the XML file.
    Any ideas?

    I think your problem is less JSP/JSTL and more querying the XML.
    You are trying to "select all <npinum> elements from a client based on clientnum"
    I am far from an expert on XPath, but I think the following query is what you are after: "/npinumbers/client[clientNum=????]/npiNum"
    To do that with JSTL you would replace ???? with $param:enteredId or $CID (equivalent in your example)
    Here is the resulting JSP page.
    <%@page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <c:import url="npiXMLTest5.xml" var="doc" />
    <x:parse varDom="dom" doc="${doc}"/>
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>NPI XJTL Test</title></head>
    <body>
    <c:set var="CID" value="${param.enteredId}" />
    <h2>NPI XJTL Test Page</h2>
    <table border="1">
    <tr><th>NPI Number</th><th>Description</th></tr>
    <x:forEach select="$dom/npiNumbers/client[clientNum=$CID]/npiNum" var="n">
      <tr><td><x:out select="npi" /></td><td><x:out select="desc" /></td></tr>
    </x:forEach>
    </table>
    <hr>
    <form>
    <input type="text" name="enteredId"/>
    <input type="submit">
    </form>
    </body></html>I made up the following test file to use with it. I don't know if it was exactly what your requirements are, but it was a best guess based on your info.
    <npiNumbers>
         <client>
              <clientNum>42</clientNum>
              <clientName>Ford Prefect</clientName>
              <npiNum>
                   <npi>123</npi>
                   <desc>life</desc>
              </npiNum>
              <npiNum>
                   <npi>234</npi>
                   <desc>universe</desc>
              </npiNum>
              <npiNum>
                   <npi>456</npi>
                   <desc>everything</desc>
              </npiNum>          
         </client>
         <client>
              <clientNum>666</clientNum>
              <clientName>Satan</clientName>
              <npiNum>
                   <npi>333</npi>
                   <desc>Baby Devil</desc>
              </npiNum>
         </client>
    </npiNumbers>Cheers,
    evnafets

  • Include new feature where user can get JSP as XML model or normal HTML

    Hi Creator Team,
    I request you guys to include the below specified feature in future updates.
    Currently, creator is supporting to generate JSPS in XML formats. No doubt this is good feature.
    But some times we may require JSP in which we may not in need of well formed HTML page.
    Because all Designeres and developers are may not aware of XML features and nodoubt they will face the problem in coding or designing.
    It is not necessary that a developer/designer need to accustom the features currently supported. He/She may expect more easier access in studio creator.
    I understand that we can include JSPs into project taht are not well formed. But at the same time it is almost difficult to him/her to design the page (drag/drop process which is main feature of Studio Creator)
    I request and suggest to include both options so that it will become easy for developers/designers to use this good product

    Has this feature been incorporated in the latest SJSC 2 release? I too think that this will be more easier to adapt to as a newbie. Moreover, I haven't found anything on this front anywhere else in the forums or in the technical documentations. Other way around could be to provide decent tutorials on using JSP in XML syntax. I am currently using J2EE tutorial (June 2005 release) to learn this technology.
    I would be glad if someone could point out a decent resource on this front.
    Thanks in advance,
    Dev

  • Transforming jsp into xml

    Hi,
    I have some *.jsp files wich I have to transform into xml and xsl pages.
    Can anyone help me with his advice?
    And maybe someone knows a handy tool to transform jsp into xml?

    Refer to
    http://developer.java.sun.com/developer/technicalArticles/xml/WebAppDev2/

  • Which Web Client Framework? BC4J-JSP, UIX-JSP, UIX-XML, etc

    Trying to determine which, if any of the JDeveloper frameworks, to use for do web browser (HTML) clients.
    What are the pros/cons of BC4J-JSP, UIX-JSP, UIX-XML, etc?
    What are some common things you might rule out using one or more of the frameworks?
    I plan to be using BC4J, updating, inserting data (currently MS-SQL) and the apps will run on WebLogic 7 or Caucho Resin (webapps no EJB) in a cluster. I would like to be as RAD as possible and still be able to do what I need to do. One main concern is being able to add custom HTML/JavaScript for things like client side validation. I didn't see a way to do this when doing BC4J-JSP. Is that right?
    If I define any validation in the BC4J, will UIX utilized any of this to define a JavaScript validator or must it be redudantly defined?
    One other concern is what the framework requires in terms of architecture, like do I have to have sticky sessions in my web cluster or can it work fine stateless or stateful?
    For UIX-XML, how is this architected for performance? Specifically, is the XML effectively compiled and converted into something more efficient and performant or does it do XML parsing all the time? Is there any significant performance differences between the frameworks?
    Is there any significant difference in dealing with security? Anything in the framework to make it easier to handle certain users being able to see/edit different set of data?
    I have things like some groups can edit only certain entities (product info but not pricing), others only certain types of products (possibly subclass entities) and others situations where what fields than can edit varies. Obviously I can handle this programmatically, but I was wondering what the frameworks had to offer, especially in terms of having different views of the same data.
    Steve

    ...I am little confused then about how BC4J works and what is meant by "session" here.
    When you talk about appmodules in the plural, does this mean that there are potentially multiple instances of the same data on a single server or there is a common datastore with pending data and client specific stuff varying?
    The common datastore is the database. Each client (momentarily, during the span of their request) uses an instance of an application module from the pool. The pool can grow and shrink with load on your system and all of the various tuning parameters. Our doc on the AM Pool covers all the parameter settings and their users.
    What kind of "session" is this?
    It is an abstract notion of a session for a user. The implementation used for Web clients uses the HTTP Session Key as the session key. However, we have other session implementations (and you can provide your own to do custom stuff for more sophisticated needs). We don't store anything else in the HTTP Session to the best of my knowledge. This way in a cluster, the web container doesn't have to waste time propagating all of your serialized HTTP Session state among cluster members. This session key also include an id for the application module and together those provide the key to store your pending state in the database for the "Stateful == Managed State" feature.
    I assume that if I have a cluster which doesn't use session-to-same-server-affinity but uses JDBC for http-session persistance or distributed in-memory http-sessions then I cannot use stateful BC4J even though I can use http-sessions.
    You can use BC4J in this way because the browser will send a cookie that contains the key to your database-stored pending state. In this way, we work great in a server farm for failover and/or scalability reasons.
    Even if I use stateless BC4J, are there issues with round-robin'ng all requests to different servers in a cluster?
    As I said, both our Stateless and Stateful features are designed to be used in Server farms, no problem.
    BTW I wouldn't necessarily say you picked the wrongs terms for the modes, but I know what you mean. There's problems with these terms. I am trying to explain to my mgrs/engineers that there is some state in stateless transactions - that simply making everything "stateless" doesn't mean don't lose anything in a disastrous failure. I am arguing to get support for sessions in our cluster, that the performance gain and simplified development is worth it as long as you put intelligent limits on what you store in the session. Right now, they are insisting on randomly sending requests into two entirely different data centers, with two different clusters.
    Amen. I have seen too many developers make the mistake of trying to be totally stateless, only to completely complicate their development environment with having to peristent partially-completed transaction data to the database. I've seen this done with sets of "Shadow" tables (yuck!) or using hand-written techniques similar to what BC4J provides a robust implementation of in the box.
    We've tuned our "Stateless With Affinity for Server Farms" model over several releases of carefully studying the performance of the Web apps built by our internal Oracle Applications teams using BC4J (over 20 of them now, and growing!) so compared with a hand-written strategy for your web-tier state management, using BC4J's implementation will be much more productive for you.
    We're tuning and tweaking and enhancing it even more for the 9.0.3 release as new needs are highlighted with continued use by our customers (both Oracle internal and external).

  • JSP, XML, XSLT: applying XSL on JSP-generated XML doc

    Hello,
    I am currently trying to figure out how to do the following:
    let's consider (that's not entirely hypothetical :) ) a web application working with JSP (on apache/tomcat 3.1) and oracle BC4J Application modules.
    The JSPs call oracle webbeans to perform updates and retrieve data from an 8.1.6 database.
    Now I'm thinking of moving to a combination of JSP, XML and XSL, which (hopefully) would allow to customize the application depending on the user's browser, language etc...(that's the point isn't it?)
    It doesn't seem to be a problem to produce XML from a jsp, send it directly to the client browser, which in turn goes to look for the proper XSL file and does all the transformation stuff.
    However this only works with I.E 5 for the moment right? and most website need to support various kinds of browsers...
    The need is:
    * When a non XML-capable browser is detected, apply the proper XSL(s) on the server side before sending the result back, in html/wml/whatever...
    * For XML-capable browsers, produce raw XML, maybe apply some XSL(s), and eventually send the result to the browser which handles the rest of the XSL stuff itself.
    Therefore, I'd like to:
    - Have the jsp produce the raw xml data (maybe adding extra tags, to indicate the browser and/or the language that the jsp engine has detected).
    - Pass the output to a first XSLT engine which would take care of the language stuff
    - Feed the result into a second XSLT engine to handle browser specificities for instance...
    - Send the final output to the client browser.
    Now, there are 2 problems:
    * 1/ I have seen various engines capable of chaining XSL transforms, and it is easy to produce XML from a jsp, but I don't know how to feed a jsp's output into an XML engine. is that possible? how?
    * 2/ I'm a bit concerned about the cost of applying three (or more) process stages, does anyone have insight on the performance issues this could raise?
    bonus question ;) : is there a simpler approach?
    Thanks a lot in advance, Remi
    null

    Hello,
    I am currently trying to figure out how to do the following:
    let's consider (that's not entirely hypothetical :) ) a web application working with JSP (on apache/tomcat 3.1) and oracle BC4J Application modules.
    The JSPs call oracle webbeans to perform updates and retrieve data from an 8.1.6 database.
    Now I'm thinking of moving to a combination of JSP, XML and XSL, which (hopefully) would allow to customize the application depending on the user's browser, language etc...(that's the point isn't it?)
    It doesn't seem to be a problem to produce XML from a jsp, send it directly to the client browser, which in turn goes to look for the proper XSL file and does all the transformation stuff.
    However this only works with I.E 5 for the moment right? and most website need to support various kinds of browsers...
    The need is:
    * When a non XML-capable browser is detected, apply the proper XSL(s) on the server side before sending the result back, in html/wml/whatever...
    * For XML-capable browsers, produce raw XML, maybe apply some XSL(s), and eventually send the result to the browser which handles the rest of the XSL stuff itself.
    Therefore, I'd like to:
    - Have the jsp produce the raw xml data (maybe adding extra tags, to indicate the browser and/or the language that the jsp engine has detected).
    - Pass the output to a first XSLT engine which would take care of the language stuff
    - Feed the result into a second XSLT engine to handle browser specificities for instance...
    - Send the final output to the client browser.
    Now, there are 2 problems:
    * 1/ I have seen various engines capable of chaining XSL transforms, and it is easy to produce XML from a jsp, but I don't know how to feed a jsp's output into an XML engine. is that possible? how?
    * 2/ I'm a bit concerned about the cost of applying three (or more) process stages, does anyone have insight on the performance issues this could raise?
    bonus question ;) : is there a simpler approach?
    Thanks a lot in advance, Remi
    null

  • XSLT, using document() to fetch a local JSP generated XML file

    All,
    I have 1 XML document that keeps track of various subsite owners of a domain I manage. The xml file doesn't hold much, something along the lines of:
    <?xml version="1.0"?>
    <sitedirectory>
         <page id="/marys_page" name="Mary's Page"">
              <content_contact ntid="smithm" />
              <technical_contact ntid="techguy" />
         </page>
    </sitedirectory>Now I also have a JSP page, that when given an NT id as a URL parameter, rifles through LDAP and spits out an xml document with all the relavent ISID fields for that person's id (first name, last name, phone number, e-mail address etc).
    I use the document() function in an XSL file to access that dynamic JSP page, fetch the contents of the resulting XML file. Using the document() function with just a regular file call like "getldap.jsp" only feeds my stylesheet the source of that JSP file, not the resulting XML file that I'm looking for when it's been processed.
    So... I have my document() function calling the full URL to that JSP file on my domain, an example <value-of /> call in my XSL file would be:
    <xsl:value-of select="document('http://my.domain.com/jsp_util/ldap_person.jsp?ntid=smithm')/person/firstname" />and I get what I want, that person's first name, drawn from LDAP into my XSL file. But it seems a little weird to me, having a server-side transformation, accessing a JSP file by making an http call to the same server the transformation resides in.
    Am I missing something? Is there a better way to do this or some directive I'm missing? I'd appreciate any help.

    That's a creative but perfectly reasonable way to use the document() function.
    There are other ways to solve the problem, such as including Java calls in your XSL and applying a customized URIResolver to your transformation, but my approach would be to use the simplest method that works acceptably. So if you don't have performance problems with your solution, I would leave it alone.

  • Question about JSP, XSLT and JDOM

    hi, folks. Let's say within page1.jsp, i have <jsp:include page="page2.jsp" flush="true"> On the other hand, i have a servlet helper class which queries the database, then converts the ResultSet object into a JDOM Document object. My question is i want to make the transformed output of the JDOM Document and XSLT template to be a partial content of the page2.jsp page. How can i get this done properly? I have no problem of doing the transformation, but just dont know how to concatenate the output with the rest content of page2.jsp. Hope i clearly explained the question. Any advice is greatly appreciated.
    //code fragment on page2.jsp
    <td valign="top" width="788">
        <font size="3"><br>  
            <p>
           //i want put the transformed results here
           </p>
         </font>
    </td>

    this is a fragment of my testing program, which transform direct to response output stream. but i dont want put this bounch of java code within page2.jsp. do i some other way around to get it done?
    Document myDocument = createDocument();
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                // Make the input sources for the XML and XSLT documents
                org.jdom.output.DOMOutputter outputter = new org.jdom.output.DOMOutputter();
                org.w3c.dom.Document domDocument = outputter.output(myDocument);
                javax.xml.transform.Source xmlSource = new javax.xml.transform.dom.DOMSource(domDocument);
                StreamSource xsltSource = new StreamSource(new FileInputStream("d:/tomcat/webapps/project/car.xsl"));
            //Make the output result for the finished document
                StreamResult xmlResult = new StreamResult(response.getOutputStream());
                //StreamResult xmlResult = new StreamResult(System.out);
            //Get a XSLT transformer
            Transformer transformer = tFactory.newTransformer(xsltSource);
            //do the transform
                transformer.transform(xmlSource, xmlResult);

  • Parameterized XSLT XML file

    I apologize if this topic is out of place, but I can not find any forum more suitable to my question. Please advise.
    I use XML and XSLT to render a "tree" in my jsp page. When user clicks a tree leaf, a new page is loaded.
    Each user will see a different tree, depending on his role defined in the application. The worst thing I can do is to have a different XML file for each role.
    Is is possible that I can have just one XML file defining a generic tree, and depends on user role, certain branches and leaves are displayable. In another words, is it possbile to have a XML file parameterized by an external variable.
    The external variable here is the user role, which comes from a session scope bean.
    MSXML has similar feature that is quite close, but my app is based on Java, Struts on Unix.

    Thanks for the hint. I am newbie, and I am quite at lost to make this work.
    Here is my tree xml file tree.xml ( a portion of if)
    =======
    <?xml version="1.0" ?>
    <?xml-stylesheet type="text/xsl" href="../css/xmlTree.xsl"?>
    <!DOCTYPE tree SYSTEM 'tree.dtd'>
    <tree>
    <branch id="IDAdmin"> <!-- Start User Administration branch -->
    <branchText> User ID Setup</branchText>
    <leaf> <leafText> Add</leafText> <link>../add_user.jsp</link> </leaf>
    <leaf> <leafText> Change</leafText> <link>#</link> </leaf>
    </branch> <!-- End of User Administration branch -->
    ===================
    Here is the xmlTree.xsl
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"></xsl:output>
    <xsl:param name="roleNm" select="'ADMINISTRATOR'"/>
    <xsl:template match="/">
    <html>
    <head>
    <title>XML Tree Control</title>
    <link rel="stylesheet" type="text/css" href="../css/xmlTree.css"/>
    <script type="text/javascript" src="../js/xmlTree.js"></script>
    </head>
    <xsl:apply-templates/>
    </html>
    </xsl:template>
    <xsl:template match="tree">
    <body>
    <b><xsl:value-of select="$roleNm"/></b>
    <xsl:apply-templates/>
    </body>
    </xsl:template>
    Here is a portion of my jsp page
    <frame name="nav_frame" bgcolor="#FFFFCC" src="tree.xm"/>' frameborder="0"
    Can youn kindly give me a bit more detail where the setParameter call should be set ? I guess it will be a scriplet in my jsp, but I don't know how to put them together. Thanks

Maybe you are looking for

  • How apply a background pattern fill that can then be properly tiled in Dreamweaver....help!

    I'm doing a web page layout that someone else is going to slice and input into dreamweaver. He wants to be able to tile the background image (in dreamweaver)  which is just a diamond pattern. When I created the background layer I filled it with the d

  • How to store multiple values associated to one key

    hello all In my program I need to store "multiple values associated to one key". for example : key would be ="T"                          Values are    = 2,4,5,1,2Plz tell me which data structure I can use for this purpose. I have tried Hashtable for

  • Ipod doesn't appear in iTunes neither on My Computer

    Like the topic says. Have called with apple support and read the website, apple said I had to call with microsoft support because it has to do with the drivers, microsoft support couldn't help me. It's not the iPod that doesn't work cause it does wor

  • Sys packages invalid

    in oracle 9i some sys packages become invalid give solution

  • To Delete Database

    hi i wanna to delete my all marketing documents form my data base how to do it.