Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 28th, 2008, 07:32 PM
Registered User
 
Join Date: Apr 2008
Location: Metuchen, NJ, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default xslt to update only a portion of a page

Is it possible to use xml and xslt stylesheet to only update a specific section of a page? ie: a div within the dom?

I could have sworn I've done this before but have lost my source files from a couple years back. Isn't this possible via javascript?
Marry your xml and xslt files and whatever the generated data is innerHTML into a div or whatever you want? Thanks guys!!
Reply With Quote
  #2 (permalink)  
Old April 28th, 2008, 07:42 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSLT doesn't update the input document, it transforms it to an output document, so if some of the input is to remain unchanged then it needs to be explicitly copied to the output. It's often convenient to do this using an identity template:

<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

augmented by template rules that match the part of the document that you want to modify.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old April 28th, 2008, 09:42 PM
Registered User
 
Join Date: Apr 2008
Location: Metuchen, NJ, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Kay,

Thank you for the response!
I apologize because I certainly didn't ask this question the right way as I often tend to do :-/
I was discussing today with someone at work of how we could use an xml feed we're getting. I thought of using xslt to parse it and spew (such a nice way of saying it huh?) it onto a regular 'ol Joe html page. Mind you...the html page was developed with straight html.

I hope I asked my question better this time. By the way, just ordered your book from a1books here in NJ. There's not another addition coming out anytime soon is there? Just so I don't kick myself in the butt in a month or two when it comes out heh


Quote:
quote:Originally posted by mhkay
 XSLT doesn't update the input document, it transforms it to an output document, so if some of the input is to remain unchanged then it needs to be explicitly copied to the output. It's often convenient to do this using an identity template:

<xsl:template match="*">
<xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
</xsl:copy>
</xsl:template>

augmented by template rules that match the part of the document that you want to modify.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #4 (permalink)  
Old April 29th, 2008, 02:55 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You can transform your XML feed into a portion of HTML and then use Javascript to update your document, provided your client browser has the facilities to load an XSLT processor.

And the latest version of Michael's book is just coming out now - "XSLT 2.0 and XPath 2.0 Programmer Reference" ISBN 978-0470192740.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old April 29th, 2008, 06:29 AM
Registered User
 
Join Date: Apr 2008
Location: Metuchen, NJ, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I KNEW IT!!! I should have waited. It's ok I can cancel :) Thanks guys really!
I'm really looking forward to contributing to the forums.

Quote:
quote:Originally posted by samjudson
 You can transform your XML feed into a portion of HTML and then use Javascript to update your document, provided your client browser has the facilities to load an XSLT processor.

And the latest version of Michael's book is just coming out now - "XSLT 2.0 and XPath 2.0 Programmer Reference" ISBN 978-0470192740.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML portion of aspx file SKhna ASP.NET 2.0 Basics 3 March 25th, 2008 10:52 AM
Extracting portion of XML ** Need help asap** aintvoguish XSLT 3 December 20th, 2007 09:12 AM
Want to print some portion of the web page. jigu_2811 C# 1 October 17th, 2006 08:16 AM
In Access - look at portion of string usvinyl Access 1 September 23rd, 2004 03:06 PM



All times are GMT -4. The time now is 01:19 PM.


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