Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: XSLT Programmer's Reference, 2nd Edition
This is the forum to discuss the Wrox book XSLT: Programmer's Reference, 2nd Edition by Michael Kay; ISBN: 9780764543814
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: XSLT Programmer's Reference, 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 22nd, 2010, 11:04 PM
Registered User
 
Join Date: Nov 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT

Hi All,

I am able to get the count of all preceding siblings with the following code.

count(preceding-sibling::*)

How do I get the count of preceding siblings with string-length greater than 4.

Thanking you,

Marudha
  #2 (permalink)  
Old November 23rd, 2010, 05:19 AM
mhkay's Avatar
Wrox Author
Points: 18,274, Level: 58
Points: 18,274, Level: 58 Points: 18,274, Level: 58 Points: 18,274, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,932
Thanks: 0
Thanked 282 Times in 277 Posts
Default

Code:
count(preceding-sibling::*[string-length(.) > 4])
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
  #3 (permalink)  
Old November 23rd, 2010, 08:40 PM
Registered User
 
Join Date: Nov 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT

Hi mhkay
Thanks

Marudha
  #4 (permalink)  
Old July 2nd, 2011, 02:30 AM
Registered User
 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Transformation using xslt

hi team,

I am using jstl to transform xml, i am not able to do this.

this my xsl.
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="/isee:ISEE-Event">

<li> <strong>Problem Area:  </strong>
<xsl:value-of select="./HP_ISEEServiceIncident/Caption" />
</li>
<li>
<strong>Problem Description:  </strong>
<xsl:value-of select="./HP_ISEEServiceIncident/Description" />
</li>
<li>
<strong>Event GUID:  </strong>
<xsl:value-of select="./HP_ISEEServiceIncident/ProviderID" />
</li>
<li>
<strong>Customer Name:  </strong>
<xsl:value-of select="./HP_ISEECustomer/Name" />
</li>
<li>
<strong>Event
Time:  </strong>
<xsl:value-of select="./HP_ISEEServiceIncident/EventTime" />
</li>
<li>
<strong>Business:  </strong>
<xsl:value-of select="./HP_ISEEServiceIncident/Business" />
</li>
<xsl:for-each select="./HP_ISEEServiceIncident/Property">
<li>
<strong>
<xsl:value-of select="./@name" />
:  
</strong>
<xsl:value-of select="./@value" />
</li>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

and also this my xml:-



<HP_ISEEServiceIncident>
<Caption>The accelerator board on the HP Smart Array 6i Controller has experienced a battery failure. The FW revision of your array controller is 2.84. Replace the battery on the HP Smart Array 6i Controller the Accel battery is spared separately; use spare part number 307132-001.

</Caption>
<Description>The accelerator board on the HP Smart Array 6i Controller has experienced a bettery failure. The FW revision of your array controller is 2.84. Replace the battery on the HP Smart Array 6i Controller the Accel battery is spared separately; use spare part number 307132-001.

</Description>
<FailingPart>Accel Battery</FailingPart>
<SparePart> 307132-001</SparePart>
<FailingPartLocation> The failing accelerator battery is on a HP Smart Array 6i Controller integrated into the server RCOM03DEVNRI001 a ProLiant DL380 G4 with serial number SGH610X1CN </FailingPartLocation>
<ServiceNotes>cpqDACntlrHwLocation contains a text string that gives location details in more complex cellular systems.
</ServiceNotes>
<AccelBatterySparePart>307132-001</AccelBatterySparePart>
<ArrayControllerModel>HP Smart Array 6i Controller</ArrayControllerModel>
<ArrayControllerFWRev>2.84</ArrayControllerFWRev>
<ArrayControllerSlot>Slot 0</ArrayControllerSlot>
<ArrayControllerSparePart/>
<ServerName>srv-001.my.com</ServerName>
<ServerModel>ProLiant DL380 G4</ServerModel>
<ServerProductID>378736-371</ServerProductID>
<ServerSerialNumber>SGH610X1CN
</ServerSerialNumber>
<ServerFWRev>P51-04/26/2006</ServerFWRev>

<Property name="EventUniqueID" value="28"/>
<Property name="ErrorType" value="Hardware"/>
<Property name="ProbableCauseDescription" value="The Fibre Channel driver has declared the link to be dead because it has been down for more than 10 seconds. Please check the following: 1. Verify that the fiber optic cable is functional and securely attached to the Fibre Channel Mass Storage Adapter. 2. Verify that the device which is connected to the adapter port is functioning correctly. 3. Verify that the adapter port is functioning correctly by performing internal and external loopback tests. Please attach a loopback hood to the adapter port when executing a loopback test. #Internal loopback test /opt/fcms/bin/fcmsutil &amp;lt;device_file&amp;gt; int {crpat | cjtpat} [count] #External loopback test /opt/fcms/bin/fcmsutil &amp;lt;device_file&amp;gt; ext {crpat | cjtpat} [count] If loopback tests show that it is not functioning correctly contact the Hewlett Packard customer representative.&amp;#xD;&amp;#xA;The Fibre Channel driver has declared the link to be dead because it has been down for more than 10 seconds. Please check the following: 1. Verify that the fiber optic cable is functional and securely attached to the Fibre Channel Mass Storage Adapter. 2. Verify that the device which is connected to the adapter port is functioning correctly. 3. Verify that the adapter port is functioning correctly by performing internal and external loopback tests. Please attach a loopback hood to the adapter port when executing a loopback test. #Internal loopback test /opt/fcms/bin/fcmsutil &amp;lt;device_file&amp;gt; int {crpat | cjtpat} [count] #External loopback test /opt/fcms/bin/fcmsutil &amp;lt;device_file&amp;gt; ext {crpat | cjtpat} [count] If loopback tests show that it is not functioning correctly contact the Hewlett Packard customer representative."/>
<Property name="RuleID" value="HPUX_dm_ql_adapter_Result_28"/>
<Property name="RuleSetVersion" value="2.2"/>
<Property name="FailingHostModelNumber" value="9000/800/rp3440"/>
<Property name="FailingHostIP" value="130.130.1.44"/>
<Property name="FailingHostName" value="tntukbps"/>
<Property name="monitorName" value="dm_ql_adapter"/>
<Property name="AnalysisToolVersion" value="V6.1 (Build 136)"/>
</HP_ISEEServiceIncident>


I am stagulling a lot please help me out .

i want's to do xml transformation and i have to display in the jsp page...

i was googled a lot not getting any solutions.

this my jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<x:parse xml="${outputxml}" var="output"/>

<c:import var="xslt" url="/WEB-INF/xsl1/event-manifest.xsl" />

<p><b>XSLT example</b></p>
<x:transform xml="${output}" xslt="${xslt}" />



please correct where i did the wrong ..
  #5 (permalink)  
Old July 2nd, 2011, 07:57 AM
mhkay's Avatar
Wrox Author
Points: 18,274, Level: 58
Points: 18,274, Level: 58 Points: 18,274, Level: 58 Points: 18,274, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,932
Thanks: 0
Thanked 282 Times in 277 Posts
Default

Firstly, please start a new thread for a new question rather than tagging you question onto the end of an old and unrelated thread.

Secondly: sorry, I don't know much about JSP or JSTL. It helps to say what error messages you are getting. The most immediately obvious thing that's wrong is that your stylesheet uses match="isee:ISEE-Event" but doesn't declare the isee namespace. But your source XML doesn't seem to have an element called isee:ISEE-Event anyway. Perhaps you trimmed it because you thought it irrelevant - which would probably be a sign that you haven't realised how important namespaces are to this kind of problem.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another question about generating XSLT with XSLT danblick XSLT 2 July 16th, 2009 09:40 PM
General XSLT Questions in the XSLT Forum jminatel BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 0 March 31st, 2008 08:50 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
dynamic xslt -> xslt creation namespace problem jkmyoung XSLT 2 July 15th, 2006 01:42 AM
xslt with an xslt outputfile alleycat XSLT 4 February 20th, 2006 09:56 AM



All times are GMT -4. The time now is 08:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.