[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re:Re:How to simplify the xslt expression for mult

Subject: RE: Re:Re:How to simplify the xslt expression for multiple conditions.
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Mon, 28 May 2001 17:10:41 +0800
domxml javascript
Hi, Jeni

> 1.  How to pass RTF around to the javascript function?

>I'm sorry - I don't quite get what you're doing here. Are you saying
>that now, rather than passing the name of an XML file into the
>Javascript function, you need to pass some generated XML? If so, you
>need to serialise that XML and escape it to create a valid Javascript

>Actually I do this in the svg-utils utility - have a look at
>http://www.jenitennison.com/xslt/utilities/svg-utils.xsl for some
>templates that you can use.

Yes, This is exactly  what I mean.  I try to appy RTF to process output page
by page.
Studying the svg-utils.xsl for  a while,   I am not quite to reach the
solution  and need your to help me out.

As your suggestion, I use two step approach to render the xml file, the
frist one is
to filter out the data based on a set of multiple condition and stored in a
Then Using the RTF to diplay the content.   Because there are couple of
hundred lines,
 I apply Chris Bayes  paging example  to  get the paging capability.  During
each paging process,
I try to repeat using  RTF, not the original xml file  to process the
output.  However I can not get
any further and hope you can provide some direction from here.

Thanks in advance.
A list of xsl is listing below fyi.

Sun-fu Yang


***  partial of xsl ****
<!-- from Jeni  svg example -->
<xsl:include href="serialiseXML.xsl"/>

  <script type="text/javascript">
    var DOMXML;
  function triggerXMLLoading()
               <xsl:text>getDOMFromXML(&apos;</xsl:text>   <===  How to
relate this conversion to the transformload in changePage function?
               <xsl:call-template name="serialiseXML">
<xsl:with-param name="originalDoc" select="$originalDoc"/>

      function getDOMFromXML(XML) {
            DOMXML = new ActiveXObject('Msxml2.FreeThreadedDOMDocument');
            DOMXML.async = false;
            DOMXML.validateOnParse = false;
            if (DOMXML.parseError.errorCode != 0) {
              alert('Error parsing XML:\n' +
           return DOMXML;

changePage(number,xmlfile,xslfile){                              <===  How
can I define xmlfile from a RTF
      XMLDOM = new ActiveXObject('Msxml2.FreeThreadedDOMDocument');
      XMLDOM.async = false;
       XSLTDOM = new ActiveXObject('Msxml2.FreeThreadedDOMDocument');
        XSLTDOM.async = false;
     XSLStylesheet = new ActiveXObject('Msxml2.XSLTemplate');
      XSLStylesheet.stylesheet = XSLTDOM;
      XSLTProcessor = XSLStylesheet.createProcessor();
     XSLTProcessor.input = XMLDOM;
      XSLTProcessor.addParameter('pagenumber', number);

***    serialiseXML.xsl  ***
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"

<xsl:output method="html" />
<xsl:strip-space elements="*" />
<xsl:template name="serialiseXML">
   <xsl:param name="originalDoc"/>
 <xsl:apply-templates select="$originalDoc" mode="serialise"/>

<xsl:template match="*" mode="serialise">
   <xsl:text />&lt;<xsl:value-of select="name()" />
   <xsl:for-each select="namespace::*[local-name() != 'xml']">
      <xsl:if test="not(../../namespace::*[local-name() =
local-name(current()) and . = current()])">
         <xsl:text> xmlns</xsl:text>
         <xsl:if test="local-name()">:<xsl:value-of select="local-name()"
         <xsl:call-template name="js-escape">
            <xsl:with-param name="string" select="." />
   <xsl:for-each select="@*">
      <xsl:text> </xsl:text>
      <xsl:value-of select="name()" />="<xsl:text />
      <xsl:call-template name="js-escape">
         <xsl:with-param name="string" select="." />
      <xsl:when test="node()">
         <xsl:text />&gt;<xsl:apply-templates mode="serialise" />
         <xsl:text />&lt;/<xsl:value-of select="name()" />&gt;<xsl:text />
      <xsl:otherwise> /&gt;</xsl:otherwise>

<xsl:template match="text()" mode="serialise">
   <xsl:call-template name="js-escape">
      <xsl:with-param name="string" select="." />

<xsl:template match="comment()" mode="serialise">
   <xsl:text>&lt;!-- </xsl:text>
   <xsl:call-template name="js-escape">
      <xsl:with-param name="string" select="." />
   <xsl:text> --&gt;</xsl:text>

<xsl:template match="processing-instruction()" mode="serialise">
   <xsl:value-of select="name()" />
   <xsl:text> </xsl:text>
   <xsl:call-template name="js-escape">
      <xsl:with-param name="string" select="." />
   <xsl:text> ?&gt;</xsl:text>

<xsl:template name="js-escape">
   <xsl:param name="string" />
   <xsl:call-template name="substitute">
      <!-- normalize spaces to get rid of line breaks, which javascript does
not like -->
      <xsl:with-param name="string" select="normalize-space($string)" />
      <xsl:with-param name="find" select='"&apos;"' />
      <xsl:with-param name="replace" select='"\&apos;"' />

<xsl:template name="substitute">
   <xsl:param name="string" />
   <xsl:param name="find" />
   <xsl:param name="replace" />
      <xsl:when test="$find and $string and contains($string, $find)">
         <xsl:value-of select="substring-before($string, $find)" />
         <xsl:value-of select="$replace" />
         <xsl:call-template name="substitute">
            <xsl:with-param name="string" select="substring-after($string,
$find)" />
            <xsl:with-param name="find" select="$find" />
            <xsl:with-param name="replace" select="$replace" />
      <xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise>


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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.