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 7813709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:58:06+00:00 2026-06-02T04:58:06+00:00

I’m preparing a Pressentation on XML and XSLT for my universities computing club, I’m

  • 0

I’m preparing a Pressentation on XML and XSLT for my universities computing club, I’m no expert but I’m better than anyone else, and it’s just a 1 hour primer.
So for my slides I figured I would use a XML document.
which I would then turn into a series of webpages with XSLT 2.0

So we have my source document

<slideshow>
  <slide title="Example">
    <para>Below is an example of an XML document</para>
    <code> <![CDATA[
<?xml version="1.0"?>
<elephant Name="Fido">
  <head>
    <eyes qty="2" colour="blue"/>
    <trunk/>
    <ears qty="2"/>
  </head>
  <body>
    Thin, ribs showning
  </body>
  <legs qty="4">
    Roughly 1.5m Long
  </legs>
</elephant> ]]>
    </code>
  </slide>
</slideshow>

Since I don’t want my examples to form part of the XML structure of the document, (and don’t want them to be changed by the XSLT)
I have the CDATA section.
So, everytime I have a <code>...</code> element, it is always written:
<code><![CDATA[...]]></code>
This is duplication, of information.

Is it possible for me to declare that every code element only contains (Unparsed) character data?

so i would just write <code>...</code>, and it would never try to parse what was inside.

seems like something that could be done with a DTD, perhaps?


The answers I’m looking for are along the lines of

Use
<!DECLARE-CDATA-ELEMENT code> which would make code elements, not have their content parsed .


You could simlate it with entitites:

<!ENTITY CodeStart "<code><![CDATA["> 
<!ENTITY CodeEnd "]]></code>">

then use: &CodeStart;<don'tParse/>&CodeEmd;


No, it can’t be done, but you can Enforce that all code sections contain no child elements by …


No, but you could do preproccessing like this: …


These aren’t answers they just indicate what answers could be like
(hopefully this is now more clear)

  • 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-06-02T04:58:09+00:00Added an answer on June 2, 2026 at 4:58 am

    Since I don’t want my examples to form part of the XML structure of
    the document, (and don’t want them to be changed by the XSLT) I have
    the CDATA section.

    It isn’t necessary to use CDATA section in order to protect some XML fragment from being “changed by the XSLT” — simply write your XSLT code in such a way that it copies any subtree rooted at a code element.

    Is it possible forme to declare that every code element only contains
    (Unparsed) character data?

    Yes, but XSLT doesn’t require that there be a DTD for either the source XML document or for the result of the processing (Schema-aware XSLT 2.0 can validate these and even intermediate results, but it works only with XML Schema (XSD) ), and in case there is such DTD, XSLT doesn’t use any type information (with the only exception being the fact that there is an ID attribute). Therefore, providing such a DTD isn’t going to be helpful.

    Also, such a DTD will be violated, unless you escape at least every & and < character in the child text-node of code:

    From the W3C XML specification:

    “[Definition: All text that is not markup constitutes the character data of the document.] The ampersand character (&) and the left angle
    bracket (<) MUST NOT appear in their literal form, except when used as
    markup delimiters, or within a comment, a processing instruction, or a
    CDATA section. If they are needed elsewhere, they MUST be escaped
    using either numeric character references or the strings ” & ” and
    ” < ” respectively
    .”

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

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.