DOC PREVIEW
CMU ISM 95733 - 03_MoreXSLT

This preview shows page 1-2-3-4-5-36-37-38-39-40-73-74-75-76-77 out of 77 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 77 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1How do we execute XSLT?Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27XPATHSlide 29Slide 30Slide 31Slide 32Slide 33An XML DocumentSlide 35Slide 36Slide 37NoteLocation PathsSlide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Matching with NodeMatching with Node -OutputSlide 52Matching with @*Matching with @* - OutputSlide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Specifying the Child AxisUsing an AxisSlide 64Slide 65Writing Output to an AttributeSlide 67PredicatesSlide 69Slide 70Slide 71Slide 72Slide 73General XPath ExpressionsSlide 75General XPath Expressions Xpath FunctionsSlide 7795-733 Internet Technologies 1195-733 Internet TechnologiesLecture 4: Programming with XSLT95-733 Internet Technologies 2How do we execute XSLT?• Using a standalone tool such as Xalan.• By calling Xalan from within a program.• By calling Xalan from within a servlet.95-733 Internet Technologies 3<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> </book>InputNetbeans Project 95-733/TestXSLT XSLT Example (1)95-733 Internet Technologies 4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = "book"> <HTML><BODY><xsl:apply-templates/></BODY></HTML> </xsl:template> <xsl:template match = "title"> <H1><xsl:apply-templates/></H1> </xsl:template> <xsl:template match = "author"> <H3><xsl:apply-templates/></H3> </xsl:template> <xsl:template match = "publisher"> <P><I><xsl:apply-templates/></I></P> </xsl:template></xsl:stylesheet>Processing95-733 Internet Technologies 5<HTML><BODY> <H1>The Catcher in the Rye</H1> <H3>J. D. Salinger</H3> <P><I>Little, Brown and Company</I></P> </BODY></HTML>Output95-733 Internet Technologies 6<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><library><block><book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> </book></block></library>InputXSLT Example (2)95-733 Internet Technologies 7<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = "book"> <HTML><BODY><xsl:apply-templates/></BODY></HTML> </xsl:template> <xsl:template match = "title"> <H1><xsl:apply-templates/></H1> </xsl:template> <xsl:template match = "author"> <H3><xsl:apply-templates/></H3> </xsl:template> <xsl:template match = "publisher"> <P><I><xsl:apply-templates/></I></P> </xsl:template></xsl:stylesheet>The default rules matchesthe root, library and block elements.95-733 Internet Technologies 8<HTML><BODY> <H1>The Catcher in the Rye</H1> <H3>J. D. Salinger</H3> <P><I>Little, Brown and Company</I></P> </BODY></HTML>The output is the same.95-733 Internet Technologies 9<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> <book>Cliff Notes on The Catcher in the Rye</book> </book>There are two bookelements in the input.XSLT Example (3)95-733 Internet Technologies 10<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = "book"> <HTML><BODY><xsl:apply-templates/></BODY></HTML> </xsl:template> <xsl:template match = "title"> <H1><xsl:apply-templates/></H1> </xsl:template> <xsl:template match = "author"> <H3><xsl:apply-templates/></H3> </xsl:template> <xsl:template match = "publisher"> <P><I><xsl:apply-templates/></I></P> </xsl:template></xsl:stylesheet>What’s the output?95-733 Internet Technologies 11<HTML><BODY> <H1>The Catcher in the Rye</H1> <H3>J. D. Salinger</H3> <P><I>Little, Brown and Company</I></P> <HTML><BODY>Cliff Notes on The Catcher in the Rye</BODY></HTML> </BODY></HTML>Illegal HTML95-733 Internet Technologies 12<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> </book>InputXSLT Example (4)95-733 Internet Technologies 13<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = "book"> <HTML><BODY><xsl:apply-templates/></BODY></HTML> </xsl:template> <xsl:template match = "title"> <H1><xsl:apply-templates/></H1> </xsl:template> <xsl:template match = "author"> <H3><xsl:apply-templates/></H3> </xsl:template><!-- <xsl:template match = "publisher"> <P><I><xsl:apply-templates/></I></P> </xsl:template>--></xsl:stylesheet>We are not matchingon publisher.95-733 Internet Technologies 14<HTML><BODY> <H1>The Catcher in the Rye</H1> <H3>J. D. Salinger</H3> Little, Brown and Company </BODY></HTML>We get the default rule matching thepublisher and then printing its child.95-733 Internet Technologies 15<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> </book>InputXSLT Example (5)95-733 Internet Technologies 16<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match = "book"> <HTML><BODY><xsl:apply-templates/></BODY></HTML> </xsl:template> <xsl:template match = "title"> <H1><xsl:apply-templates/></H1> </xsl:template> <xsl:template match = "author"> <H3><xsl:apply-templates/></H3> </xsl:template> <xsl:template match = "publisher"> <!-- Skip the publisher --> </xsl:template></xsl:stylesheet>We can skip the publisherby matching and stoppingthe recursion.95-733 Internet Technologies 17<HTML><BODY> <H1>The Catcher in the Rye</H1> <H3>J. D. Salinger</H3> </BODY></HTML>95-733 Internet Technologies 18<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="demo1.xsl"?><shelf> <book> <title>The Catcher in the Rye</title> <author>J. D. Salinger</author> <publisher>Little, Brown and Company</publisher> </book> <book>


View Full Document

CMU ISM 95733 - 03_MoreXSLT

Download 03_MoreXSLT
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view 03_MoreXSLT and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view 03_MoreXSLT 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?