By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,536 Members | 1,504 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,536 IT Pros & Developers. It's quick & easy.

Select element value based on attribute values in XML.

P: 2
I am applying XSLT to WSDL to generate html pages.

now, as WSDL is not having comprehensive details, i am adding XML documentation (.NET) as well in XSLT.
like this..
Expand|Select|Wrap|Line Numbers
  1. <xsl:variable name="ddoc" select="document('CustomerCare.ManageMeterReads.ServiceContracts.xml')" />
Here is the XML documentation....
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <doc>
  3. <assembly>
  4. <name>CustomerCare.ManageMeterReads.ServiceContracts</name>
  5. </assembly>
  6. <members>
  7. <member name="T:abc.pqr.test.CustomerCare.ManageMeterReads.ServiceContracts.CommonEntities.EmployeeID">
  8. <summary>
  9. Holds the configuration details for each Service.
  10. </summary>
  11. </member>
  12. </members>
  13. </doc>

WSDL is having element types e.g. EmployeeID ( i am able to extract the element types from XSDL, storing it in $type-local-name) however the description of that element is in above xml. my requirement is to get the "summary" element from above xml based on the member/name attribute.

WSDL just contain "EmployeeID" not full value "T:abc.pqr.test.CustomerCare.ManageMeterReads.Serv iceContracts.CommonEntities.EmployeeID".

I tried this... but not working...
Expand|Select|Wrap|Line Numbers
  1. <xsl:value-of select="$ddoc/doc/members/member[contains($ddoc/doc/members/member/@name,$type-local-name)]/summary"/>
Mar 24 '09 #1
Share this Question
Share on Google+
3 Replies


jkmyoung
Expert 100+
P: 2,057
Look for the name attribute at the node you currently are condition testing.
[contains(@name,$type-local-name)]
Mar 24 '09 #2

P: 2
I tried this...
<xsl:value-of select="$ddoc/doc/members/member[@name='contains(@name,$type-local-name']/summary"/>

however its not showing any results.

i want to extract summary element in $ddoc where attribute "name" is having value that contains $type-local-name'
Mar 25 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
I think jkmyoung was rather proposing this
Expand|Select|Wrap|Line Numbers
  1. <xsl:value-of select="$ddoc/doc/members/member[contains(@name,$type-local-name)]/summary"/>
Mar 25 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.