Subject: RE: [xsl] imbedding xsl stylesheet within xml doc ??? From: "Bovy, Stephen J" <STEPHEN.Bovy@xxxxxx> Date: Thu, 2 Sep 2004 18:40:01 -0400 |
One more stupid question, BTW, a big hearty thank you to everyone who has answered my questions (: Extracted from the web site: ************************************************************************ ************************* 2.7 Embedding Stylesheets Normally an XSLT stylesheet is a complete XML document with the xsl:stylesheet element as the document element. However, an XSLT stylesheet may also be embedded in another resource. Two forms of embedding are possible: the XSLT stylesheet may be textually embedded in a non-XML resource, or the xsl:stylesheet element may occur in an XML document other than as the document element. To facilitate the second form of embedding, the xsl:stylesheet element is allowed to have an ID attribute that specifies a unique identifier. NOTE:In order for such an attribute to be used with the XPath id function, it must actually be declared in the DTD as being an ID. The following example shows how the xml-stylesheet processing instruction [XML Stylesheet] can be used to allow a document to contain its own stylesheet. The URI reference uses a relative URI with a fragment identifier to locate the xsl:stylesheet element: <?xml-stylesheet type="text/xml" href="#style1"?> <!DOCTYPE doc SYSTEM "doc.dtd"> <doc> <head> <xsl:stylesheet id="style1" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> ************************************************************************ ************************* What does the following note mean: NOTE:In order for such an attribute to be used with the XPath id function, it must actually be declared in the DTD as being an ID. BTW I seem to be geting duplicate emails from this list, can someone please tell me how to squelch the "dup" ????? -----Original Message----- From: Bovy, Stephen J Sent: Thursday, September 02, 2004 2:08 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] imbedding xsl stylesheet within xml doc ??? Thanks for the response !!! >>I'm not sure how widely supported this feature is, or how widely used Heck Why not It seems to me that most style sheets by their very nature are going to be "specific" >>where the stylesheet is completely specific to that document; in this case I find it eases maintenance to keep the >>stylesheet embedded within the document Hey, I wonder if this same technique could be used to imbed the schema for an xml doc within the doc itself ????? NOTE:A stylesheet that is embedded in the document to which it is to be applied or that may be included or imported into an stylesheet that is so embedded typically needs to contain a template rule that specifies that xsl:stylesheet elements are to be ignored. How do you write the template rule to ignore the "xsl:stylesheet element" ??? -----Original Message----- From: Michael Kay [mailto:mhk@xxxxxxxxx] Sent: Thursday, September 02, 2004 1:43 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] imbedding xsl stylesheet within xml doc ??? I don't think the XSLT 1.0 spec uses either of the terms "imbed" or "processor statement" so I'm not sure why you put them in quotes. But section 2.7 of the spec does discuss how a stylesheet may be embedded in a source document, and gives an example: http://www.w3.org/TR/xslt#section-Embedding-Stylesheets I'm not sure how widely supported this feature is, or how widely used. It works in Saxon, and I've got one situation where I use it myself: a one-off document with its own stylesheet, where the stylesheet is completely specific to that document; in this case I find it eases maintenance to keep the stylesheet embedded within the document. (And it gives me a test case, of course!). Michael Kay www.saxonica.com > -----Original Message----- > From: Bovy, Stephen J [mailto:STEPHEN.Bovy@xxxxxx] > Sent: 02 September 2004 21:12 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] imbedding xsl stylesheet within xml doc ??? > > The xsl spec states that the xml-stylesheet processing instruction can > use an href that uses a relative url fragment. It also tantalizingly > imples that this method can be used to "imbed" a sytle sheet within > the "processor statement" itself, (which seems quite bizarre). > > Can anyone explain to me or show me how to use this technique ???
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] imbedding xsl stylesheet , Bovy, Stephen J | Thread | Re: [xsl] imbedding xsl stylesheet , cking |
[xsl] Check for text between two e, Sameer N | Date | Re: [xsl] Check for text between tw, Josh Canfield |
Month |