Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Help in XSL

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am beginner in XML/XSL.Below is my XML Code.
How do i find out the position of "Shares" using XSL.

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="sample_xslt_for_e552022222.xsl"?>
<FormatReportDataRequest>
<DocumentFormat>QIF</DocumentFormat>
<DocumentTitle>2673-2783</DocumentTitle>
<ColumnNameList>
<ColumnName>ProcessDate</ColumnName>
<ColumnName>TradeDate</ColumnName>
<ColumnName>TransactionDs</ColumnName>
<ColumnName>TransactionStatus</ColumnName>
<ColumnName>Shares</ColumnName>
<ColumnName>Price</ColumnName>
<ColumnName>GrossAmount</ColumnName>
<ColumnName>NetAmount</ColumnName>
<ColumnName>ShareBalance</ColumnName>
<ColumnName>DividendRate</ColumnName>
</ColumnNameList>
<RowValueList>
<ColumnValueList>
<ColumnValue>09022004</ColumnValue>
<ColumnValue>03202004</ColumnValue>
<ColumnValue>XYZ</ColumnValue>
<ColumnValue>Cleared</ColumnValue>
<ColumnValue>20</ColumnValue>
<ColumnValue>10.01</ColumnValue>
<ColumnValue>2001.01</ColumnValue>
<ColumnValue>1991.01</ColumnValue>
<ColumnValue>88</ColumnValue>
<ColumnValue>8.00</ColumnValue>
</ColumnValueList>
<ColumnValueList>
<ColumnValue>09022004</ColumnValue>
<ColumnValue>03202004</ColumnValue>
<ColumnValue>YYYY</ColumnValue>
<ColumnValue>Cleared</ColumnValue>
<ColumnValue>10</ColumnValue>
<ColumnValue>20.01</ColumnValue>
<ColumnValue>3001.01</ColumnValue>
<ColumnValue>5991.01</ColumnValue>
<ColumnValue>68</ColumnValue>
<ColumnValue>7.00</ColumnValue>
</ColumnValueList>
</RowValueList>
</FormatReportDataRequest>

Thanks in Advance,
Priya
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "position"?
What is the larger goal you're trying to achieve?
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By Position, i mean the element position(here ,the column no.5 corresponds to 'Shares') in the XML.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyway, if you need an XPath expression to point you to the ColumnName node that has the value "Shares", here's one such expression:
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I actually want to pickup the values from the "<ColumnValueList>" correspoding to "Shares" in the "<ColumnNameList>" (which is 20 and 10).

Thanks in Advance,
Priya.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Priya Jotwani:
Hi,
I actually want to pickup the values from the "<ColumnValueList>" correspoding to "Shares" in the "<ColumnNameList>" (which is 20 and 10).
Thanks in Advance,
Priya.



IMHO..first thing is the XML schema behind this XML is not well designed for your use-case.If you have the option to change the xml schema, then do consider that which inturns helps you to read the xml values using xpath in an easy manner.
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

I am new to XML Stuff. Please tell me as to whats wrong in the Schema and how should I corrcet it ?

Thanks in Advance,
Priya
 
reply
    Bookmark Topic Watch Topic
  • New Topic