OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   <xsl:insert> - Further Description

[ Lists Home | Date Index | Thread Index ]
  • From: Jim Garrett <jgarrett@navix.net>
  • To: AndrewWatt2000@aol.com, "Xml-Dev@Xml. Org" <xml-dev@xml.org>
  • Date: Mon, 24 Jul 2000 19:48:30 -0500


Hi again XML DEV and Andrew Watt
cc:

I have many times published this question to the
XML DEV group and Mulberry as well as to the Microsoft
site and WROX press site's...no one offered a reply..except
on xsl:include and xsl:import ....so this is the last
attempt to find a XMLDOM solution before I just use my already
written custom merge application....to merge the various xsl
files into a resultant xsl file and then send that file with
the xml file to the XMLDOM for "final" transformation....



What I am doing is attempting to do is use a master xsl (listing 1)
sheet as a template for all pages on a web site...

This way I can just copy a new instance of the master and
only have to change the maincontent.xsl sheet that has
the different content for each page ...the logo, menu,
footer would not have to be edited in all the copies of
the templates...rather the logo, menu, footer, would only
have to be edited just once in their respective xsl files
in order to propagate throughout all the instances of the
master template...

I have listed the includes in the master style sheet....(listing 1)

There are a few instances of the master that would actually
incorporate changing data and for them there would actually
be a complex tree of data in the xml file but for the
most part...I am using a simple tree to just have as a token
xml file in order to cause the XMLDOM to transform source
into result...so most of the site is just xsl ....


the menu.xsl file is just a vertical table many rows by 1 column
with hyperlinks in them...

the logo.xsl file is just a table with a few rows and a few
columns that have the company's logo's and slogans in them..

the footer.xsl file is again just a table with a few rows
and a few columns that have various hyperlinks and industry
specific logos and information...


let me know if I have been successful in explaining the need
for just a simple xsl:insert element...

Sincerely
Jim Garrett
jgarrett@navix.net

Here are the listings from the above explanation...

(listing 1)

==========begin master xsl style sheet ===================
<?xml version="1.0" ?>
<!--  <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" >  -->
<!-- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:space="preserve">



<xsl:template match="COMPANY/MASTERXSL">

<!--  ***************************************************************  -->
<!--  ***************************************************************  -->
<!--  ***************************************************************  -->
<!--  ***************************************************************  -->
<!--  ***************************************************************  -->
<!--  ***************************************************************  -->



<!-- script section begins ////////////////////////////////////////// -->

<!--
<xsl:script>
  <![CDATA[
        function foo(varFoo1) {
          return varFoo2 = varFoo1;
        }

  ]]>
</xsl:script>
-->
<!-- script section ends //////////////////////////////////////////// -->

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"></meta>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0"></meta>
<meta name="ProgId" content="FrontPage.Editor.Document"></meta>
<title>SomeCompany (c) 2000</title>
</head>


<body topmargin="0" leftmargin="0">

<table name="MasterTable" border="0" cellpadding="0" cellspacing="0"
width="100%">
  <tr>
    <td name="MasterTable-LeftCell" height="100%" valign="top">
      <table name="MasterTable-LeftSubTable" border="0" cellpadding="0"
cellspacing="0" width="100%" height="100">
        <tr>
          <td name="MasterTable-LeftSubTable-TopCell" width="100%">
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
<!-- Company LOGO
////////////////////////////////////////////////////////////////////////////
/////////////////// -->

     <table name="LogoTable" border="0" cellpadding="0" cellspacing="0"
width="125">
      <tr>
        <td height="125">


<!-- note this is not used since the next logo include formats better, but
has been left here just in case I want to put it in -->
<!--  <xsl:include href="singlecompanylogo.xsl" />  -->



        </td>
      </tr>
     </table>

<!-- Company LOGO - ends
////////////////////////////////////////////////////////////////////////////
///////////// -->
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
<!--
////////////////////////////////////////////////////////////////////////////
///////////////////////////// -->
          </td><!-- end MasterTable-LeftSubTable-TopCell  -->
        </tr>
        <tr>
          <td name="MasterTable-LeftSubTable-BottomCell-(MenuLocation)"
width="100%">
<!--
****************************************************************************
**************************** -->
<!--
****************************************************************************
**************************** -->
<!--
****************************************************************************
**************************** -->
<!-- MENU - begins
****************************************************************************
************** -->







<!-- here is where I would put the non changing menu style sheet, note this
menu.xsl file
would just do a template match on an empty tag pair called <MENU></MENU> in
the xml file
..as would all the others...the only time I am puttting any data in the xml
file is when
the content section actually has it ...of course if I could make this insert
thing work,
I would put the menu names and hyperlinks in the menu.xsl file but for now I
am not using
the xml file for nothing more than separate empty tags so that all the
included files have
a match that is separate.. -->
  <xsl:include href="menu.xsl" />








<!-- MENU - ends
****************************************************************************
**************** -->
<!--
****************************************************************************
**************************** -->
<!--
****************************************************************************
**************************** -->
<!--
****************************************************************************
**************************** -->
          </td><!-- end
asterTable-LeftSubTable-BottomCell-(MenuLocation)  -->
        </tr>
      </table><!-- end MasterTable-LeftSubTable -->
    </td>
    <td name="MasterTable-RightCell" width="82%" height="100%" valign="top">

      <table name="MasterTable-RightSubTable" border="0" cellpadding="0"
cellspacing="0" width="100%" height="100">
        <tr>
          <td name="MasterTable-RightSubTable-TopCell" width="100%"
valign="top">
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
<!-- HEADER LOGO - begins
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -->







<!-- here is where I would put the non changing company main logo style
sheet -->
  <xsl:include href="maincompanylogo.xsl" />







<!--  HEADER LOGO - ends
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||| -->
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
<!--
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||| -->
          </td><!-- end MasterTable-RightSubTable-TopCell -->
        </tr>
        <tr>
          <td name="MasterTable-RightSubTable-BottomCell-(ContentLocation)"
width="100%" valign="top">
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!-- CONTENT - begins
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++ -->




<!-- here is where I would put the "changing" various content style
heets  -->
   <xsl:include href="maincontent.xsl" />





<!-- CONTENT - ends
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!-- FOOOTER - begins
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++ -->


<!-- here is where I would put the non changing company footer style
sheet -->
   <xsl:include href="footer.xsl" />




<!-- FOOTER - ends
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->
<!--
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ -->



          </td><!-- end
MasterTable-RightSubTable-BottomCell-(ContentLocation)  -->
        </tr>
      </table><!-- end MasterTable-RightSubTable -->
    </td><!-- end MasterTable-RightCell -->
  </tr>
</table><!-- end MasterTable -->

</body>
</html>


</xsl:template>
</xsl:stylesheet>

========end master xsl style sheet================


I was able to create a simple include master xsl file
that includes all the include files but then
that just stuffs each one under the one above....and
you are unable to have them layout in the master
embedded tabling scheme....



e.g.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:space="preserve">

   <xsl:include href="menu.xsl" />
   <xsl:include href="top.xsl" />
   <xsl:include href="maincontent.xsl" />
   <xsl:include href="footer.xsl" />

</xsl:stylesheet>




I attempted to break up the master xsl file into parts and
then insert the menu, logo, footer in them, but of course that
cause's the master to not be well formed and it of course fails
to transform...(using listing 1)
e.g. see the following....>>>>>>>>>

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:space="preserve">

   <xsl:include href="master_premenu.xsl" />
   <xsl:include href="menu.xsl" />
   <xsl:include href="master_postmenu_pretop.xsl" />
   <xsl:include href="maincompanylogo.xsl" />
   <xsl:include href="master_posttop_precontent.xsl" />
   <xsl:include href="maincontent.xsl" />
   <xsl:include href="master_postcontent_prefooter.xsl" />
   <xsl:include href="footer.xsl" />
   <xsl:include href="master_postfooter.xsl" />

</xsl:stylesheet>



The only solution I have right now other than complex transformation
which is still uncooked on my stove...is to use an actual programming
language to grab each of the above xsl files and merge them
into one large xsl file and then send it to the XMLDOM for
transformation ...which works except for the fact I am using
a custom written application to do what would so simply be
accomplished if there were a xsl:insert element...

Well anyway ....that is somewhat of a more detailed explanation
and reasoning behind the request for the xsl:insert element...


Thanks you all for your time to read and think about this

Jim Garrett
jgarrett@navix.net




|-----Original Message-----
|From: AndrewWatt2000@aol.com [mailto:AndrewWatt2000@aol.com]
|Sent: Monday, July 24, 2000 7:52 AM
|To: jgarrett@navix.net
|Subject: <xsl:insert>
|
|
|Hi Jim,
|
|I was wondering if I could have a look at one of your XSLT stylesheets.
|
|I am trying to understand what it is *exactly* that you are trying
|to do and
|what it is that won't work.
|
|BTW you might be better posting your request on the XSL list. Visit
|http://www.mulberrytech.com/ and choose the "XSL-List" link on the
|left for
|further information.
|
|Also if you *really* want to reach the W3C XSLT Working Group then
|I suggest
|you also visit the www.w3c.org site, and follow the XSL link (bottom right
|somewhere). Here is the direct link to email the editors of the spec -
|mailto:xsl-editors@w3.org
|
|Regards
|
|Andrew Watt





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS