Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
Old November 23rd, 2010, 05:19 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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
 
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
 
Old July 2nd, 2011, 01: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 ..
 
Old July 2nd, 2011, 06:57 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Another question about generating XSLT with XSLT danblick XSLT 2 July 16th, 2009 08: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 07: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 12:42 AM
xslt with an xslt outputfile alleycat XSLT 4 February 20th, 2006 09:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.