Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6343595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:28:11+00:00 2026-05-24T20:28:11+00:00

I have a XML file and an external XSLT file. Currently, within my XML

  • 0

I have a XML file and an external XSLT file.

Currently, within my XML I refer to an external XSLT link using an href:

 <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="stylesheet.xsl" ?>
     <mytag>
         <t1> </t1>
         <t2> </t2>
         <t3> <t3>
     <mytag>

How can I use inline XSLT instead? Is this possible? If yes, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:28:12+00:00Added an answer on May 24, 2026 at 8:28 pm

    Yes, it is possible to embed the XSLT inside of your XML.

    XSLT is an XML file, so you would just need to make sure that you put it inside of the document element of your XML file, so that the XML file is still well-formed.

    In fact, it is described in the XSLT specification:

    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.

    Depending on how you plan to leverage it, embedded stylesheets may not be supported. For instance, in IE 6/7/8. There are some workarounds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have a input file Main.xml <?xml version=1.0 encoding=utf-8 ?> <Employees> <Employee> <id name=id>1</id>
I currently have an iPhone app that reads data from an external XML file
I have an xml file, currently external to the C# code and it is
I have an XML file which I need to parse using PHP and send
I have student.xml file and am parsing this file using SAX Parser and now
I have written an xslt that reads some xml file names and does some
The setup: I have an external XML file I have no control over, here
Aloha, I have a 8MB XML file that I wish to deserialize. I'm using
I have an xml file from an external system that looks like this. <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.