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

Trying to use XSLT to convert XML to HTML

P: 7
I am trying to make an html from an xml sheet using an xslt. I cannot seem to get the data displayed individually. I think it is because of the schema in the xml. How can I change my xsl to display (for example) just the <Abstract>?
Thank you!

The XML:

Expand|Select|Wrap|Line Numbers
  1.  <?xml version="1.0" encoding="UTF-8"?> 
  2. <?xml-stylesheet type="text/xsl" href="Tank_Sip header.xsl"?>
  3. <RecipeElement xmlns="urn:Rockwell/MasterRecipe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SchemaVersion="3519">
  4. <RecipeElementID>TANK_SIP</RecipeElementID>
  5. <Header>
  6. <Abstract>Operation</Abstract>
  7. <ApprovedBy></ApprovedBy>
  8. <DBSchema>3519</DBSchema>
  9. <DefaultSize>100</DefaultSize>
  10. </Header>
  11. </RecipeElement>
  12.  
The XSL:

Expand|Select|Wrap|Line Numbers
  1.  <?xml version="1.0" encoding="UTF-8"?> 
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.  
  4. <xsl:template match="RecipeElement/Header">
  5. <body>
  6. <h1>Abstract: <xsl:value-of select="../Abstract"/></h1>
  7. </body>
  8.  
  9. </xsl:template>
  10. </xsl:stylesheet>
  11.  
Jun 6 '07 #1
Share this Question
Share on Google+
2 Replies


DeMan
100+
P: 1,806
Hi redgrL86,

Might move this post to the XML forum, the experts there may have a better idea of how to address your problem. Hope they can help you out!!
Jun 6 '07 #2

dorinbogdan
Expert 100+
P: 839
In your code just update one line:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. <xsl:value-of select="Abstract"/>
  3. ...
Jun 8 '07 #3

Post your reply

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