This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Q XSLT: How to copy elements with XT?



Now I have got just one other problem. :-)

Mike Kay wrote:

> > The problem is that I do not know how apply templates to my elements
> > only and copy XHTML tags into result file without changes.
>
> Write a default template that copies elements:

...

> And then specific template rules for your own elements that do something
> different.

I had changed my template but XSLT has a strange behavior. If I use DOCTYPE
declaration, only the copy template is applied. More precise all elements that
are children of XHTML tags are copied into output. The XSLT work as I exepcted
only in case I comment out DTD declaration in my XML file. Other XML files that
don't have XHTML tags are processed without problems.

What is wrong?

My XML file and DTD declarations are below. (I had changed some names)

Regards!

Vit

======================= XML START ========================

<?xml version="1.0" ?>
<!DOCTYPE MyRootElement SYSTEM "XHTML_With_My_Elements.dtd">
<!-- HINT: if DOCTYPE is present, XT copies elements.
 +         To perform XSL transformation remove DOCTYPE
 *-->
<MyRootElement
  date="2000-07-04"
  author="Vitaly Rudovich"
  DTDID="XHTML"
  >
  <MyParametersList>
  <MyParameter name=":test_sql"
               value="select * from some_table"
               type="string"
               description="The SQL select command"
                />
  </MyParametersList>
  <html>
  <head>
    <title> TEST XHTML </title>
  </head>
  <body>

  <h1> Common test</h1>
  ....
     <p> <MyText >Execution time = </MyText><MyTime>...</MyTime> </p>
  ....

======================= XML END   ========================

If DOCTUPE is present the result is:

================= XSLT Result Start  ========================

  <html  xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title> TEST XHTML </title>
  </head>
  <body>

  <h1> Common test</h1>
  ....
     <p> <MyText >Execution time </MyText> <MyTime>...</MyTime> </p>
  ....

================= XSLT Result  END   ========================



======================= DTD START  ========================

<!-- Redefine My Root element content  -->
<!ENTITY % my_root_element_content "((MyParametersList)? ,html)">

<!-- Redefine XHTML misc content -->
<!ENTITY % misc "    MyParameter
                   | MyText
                   | MyTable
                   | MyTime
                   ....
                   | MySQLQuery
                   ">
<!-- Include declaration of my elements  -->
<!ENTITY % myelements.decl SYSTEM
                       "MyElements.dtd">
%myelements.decl;

<!-- Include XHTML declaration -->
<!ENTITY % xhtml.decl SYSTEM
                       "xhtml1Dtd/xhtml1-strict.dtd">
%xhtml.decl;

<!-- *********** My additional elements  ******* -->
...
=======================  DTD END   ========================




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]