Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 September 21st, 2007, 11:57 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ashyabhi
Default x path issue


<BugCollection version="1.2.1" sequence="1" timestamp="1190300340528" analysisTimestamp="1190300340512" release="">
Hi ,
I have a sample xml document follows.

<BugCollection>
 <Project filename="DealDecisionCommon">
        <Jar>C:\snapshot_view\AV_DealDecision\AD_Services\ GRD_R2\DealDecisionCommon\build\classes\com\wellsf argo\dealdecision\parallel\PricingLoopResponse.cla ss</Jar>
<AuxClasspathEntry>C:\snapshot_view\AV_DealDecisio n\AD_Services\DealDecisionMain\DealDecision\APP-INF\lib\DealDecisionCommon.jar</AuxClasspathEntry>
 </Project>


  <BugInstance type="MS_SHOULD_BE_FINAL" priority="3" abbrev="MS" category="MALICIOUS_CODE" first="1">
    <Class classname="com.wellsfargo.dealdecision.common.Cons tants">
      <SourceLine classname="com.wellsfargo.dealdecision.common.Cons tants" start="3" end="97" sourcefile="Constants.java" sourcepath="com/wellsfargo/dealdecision/common/Constants.java"/>
    </Class>
    <Field classname="com.wellsfargo.dealdecision.common.Cons tants" name="COMMON" signature="Ljava/lang/String;" isStatic="true">
      <SourceLine classname="com.wellsfargo.dealdecision.common.Cons tants" sourcefile="Constants.java" sourcepath="com/wellsfargo/dealdecision/common/Constants.java"/>
    </Field>
    <SourceLine classname="com.wellsfargo.dealdecision.common.Cons tants" start="70" end="70" startBytecode="2" endBytecode="2" sourcefile="Constants.java" sourcepath="com/wellsfargo/dealdecision/common/Constants.java"/>
  </BugInstance>

  </BugCollection>




now my problem is i have to find out the Project filename on the basis on BugInstance Category and Class classname.

like if BugInstance Category is 'X' and Class classname is 'Y' then this Bug belongs to which project.
 
Old September 21st, 2007, 03:45 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

[Edited]
You only have one Project and one BugInstance, are there repeated Project elements and do the associated BugInstance elements always come immediately afterwards?

It would be better design to have the BugInstance elements nested within the Project element.

--

Joe (Microsoft MVP - XML)
 
Old September 21st, 2007, 05:08 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

if BugInstance Category is 'X' and Class classname is 'Y' then this Bug belongs to which project

My guess would be that it belongs to project DealDecisionCommon, because that's the only project there is. But perhaps I'm wrong, perhaps it belongs to project Z.

Please give a better description of your problem and remember that your readers can't guess what your XML means just by looking at a sample of it. You also need to say something about the environment you are working in.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 22nd, 2007, 12:24 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Michael,
question to your answer is..
each <BugCollection> element can have exact one <project> child element and can have multiple <BugInstance> (as a single project can have many bugs of many type.) and we can have multiple <BugCollection> as well.

you are right if i can change the this xml structure and put <BugInstance> , i will be easy n good design.
but my problem is that this XML format is being generated by some third party tool. and i have to write a xslt to fetch meaningful information from this huge xml file.

 
Old September 22nd, 2007, 02:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can find the BugInstance using

<xsl:variable name="bug" select="//BugInstance[category="$category" and Class/@classname=$classname]"/>

You can then find which project it belongs to using

select="$bug/preceding-sibling::Project"

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old September 23rd, 2007, 01:47 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Michael..







Similar Threads
Thread Thread Starter Forum Replies Last Post
java library path issue elixiradeel Apache Tomcat 0 June 5th, 2008 07:59 AM
Need Help with path for loading Pics (app.path) Tabbasum Beginning VB 6 2 November 15th, 2007 04:57 AM
using app.path in database path and filename kd8con VB Databases Basics 2 October 25th, 2006 11:45 AM
Fixing virtual directory root path issue seanmayhew BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 10th, 2004 10:45 PM





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