469,602 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Extracting an Element from an XML and aapy XSLT on it...

Hi,
I need some thing like this.
I have an XML file and it contain some elements(tag) with a proper hierarchy...

In that XML a particular element <page> contain some child node element like below

.....
<page>
<Question></Question>
<Question></Question>
<subquestions></subquestions>
</page>

<page>
<Question></Question>
<Question></Question>
<subquestions></subquestions>
</page>
......

I need to extract this page element dynamically from this XML file and want to apply XSLT on it and want to display the resultant HTML file in the browser..

when I click on the button placed on my web page it would fetch the information from the XML file and apply XSLT on it and pass the generated HTML source to the page on which i have placed a button...

My programing background is .NET and the language i m using is VB.NET
XML Version 1.0
XSLT Version 1.0

please help me...ASAP
Aug 8 '07 #1
1 1186
jkmyoung
2,057 Expert 2GB
Are you using the XslCompiledTransform Class ?
http://msdn2.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx

Also, can you run the transformation on the entire page, but simply set up the XSLT to selectively apply on the specified nodes?

Eg, have a root template:
Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="/">
  2. <html>
  3. <head/>
  4. <body>
  5. <xsl:apply-templates select="//page"> <!-- only run transformation on page elements -->
  6. </body>
  7. </html>
  8. </xsl:template>
Aug 8 '07 #2

Post your reply

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

By using this site, you agree to our Privacy Policy and Terms of Use.