W3C home > Mailing lists > Public > xml-encryption@w3.org > January 2001

Re: XML XSL in one file...

From: <eric.e.cohen@us.pwcglobal.com>
Date: Tue, 16 Jan 2001 09:16:53 -0500
To: Alan Brian Haefele <ahaefele@profida.co.za>
Cc: xml-encryption@w3.org
Message-id: <852569D7.001B9E15.00@intlnamsmtp20.us.pw.com>


From ther XSLT specification (http://www.w3.org/TR/xslt):

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">
<xsl:import href="doc.xsl"/>
<xsl:template match="id('foo')">
  <fo:block font-weight="bold"><xsl:apply-templates/></fo:block>
</xsl:template>
<xsl:template match="xsl:stylesheet">
  <!-- ignore -->
</xsl:template>
</xsl:stylesheet>
</head>
<body>
<para id="foo">
...
</para>
</body>
</doc>

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.

Let me know if I can help further - send a sample of the XML and the XSL and I
will try to put them together for you if you wish.

Eric E. Cohen
PwC XBRL (Extensible Business Reporting Language) Technical lead
716-271-4070




To:   xml-encryption@w3.org
cc:
Subject:  XML XSL in one file...


Hi all...

I'm looking for a complete example to see how to combine XML and XSL in one
file...

Thanks



----------------------------------------------------------------
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited.   If you received this in error, please
contact the sender and delete the material from any computer.
Received on Wednesday, 17 January 2001 00:04:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 October 2009 08:42:18 GMT