Problem using "xsl:include"

I am trying to include one xsl file in another. When I do this, I get the error:
"oracle.xml.parser.v2xslexception: xsl-1002: Error while processing xsl file (no protocol tabledef.xsl" - where tabledef.xsl is the name of the xsl file I am trying to include. Any thoughts? I bet I am missing something simple, but I've looked at it a few times and can't see anything obviously wrong.

The included files are included by href.
This href is relative to the current document's base URI.
How are you passing the initial stylesheet
to the XSL processor? in a stream perhaps, where it cannot determine the "current directory" to use as the base for the relative include's?

Similar Messages

  • Problems faced when using xsl:include and extension functions

    I am Working in XML and XSLT using Oracle's XML Parser V2.
    Previously i had worked in Microsoft technology using MSXMLParser.
    I am facing some problems in XSLT. They are as below...
    1. Using <xsl-include href="Somexsl.xsl">
    the oraclexmlparser processor is giving the error : XSL-1002: Error while processing include XSL file (no protocol: Submenu.xsl).
    * Can u tell me why i am getting this error, and what is the fix for this.
    The same case with <xsl:import> too.
    2. In case i have to write some functions in the previous WD of xsl i used these statements
    <?xml version='1.0'?>
    <!DOCTYPE PageRoot SYSTEM "../../Common/dtd/PageNavBar.dtd">
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/TR/WD-xsl"
    xmlns:html="http://www.w3.org/TR/REC-html40"
    result-ns="">
    <xsl:script xmlns:xsl="uri:xsl"><![CDATA[
    var strWebContentPath = "/SurSITE/Content/";
    var strWebImagePath = "/SurSITE/sursitegraphics/";
    function IncScript()
    return "<script language='javascript' src='/SurSITE/Includes/avalidations.js'></script>";
    ]]>
    </xsl:script>
    To call the function i used this
    <xsl:eval no-entities='true'> IncScript();</xsl:eval>
    * Can u tell me how do i do this now, i tried with the code above using the current name space (<xsl:stylesheet version="1.1"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />)
    Please use the example given above.
    I will be very greatfull to u if u can give me some suggestion or help for the above said problems.
    Thanking you and eagerly waiting for your reply(s).
    null

    The current version is "1.0" not "1.1"
    You haven't included the code for what your <xsl:include>
    statement looks like, which seems to be what it's complaining
    about...
    XSLT 1.0 has no <xsl:eval>, this is a microsoft specific tag
    from a pre-XSLT-1.0 version.
    XSLT 1.0 has no <xsl:script> element either.

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • XSLT : Problem using xsl:value-of disable-output-escaping="yes"

    Hello,
    I have some problem using "disable-output-escaping" attribute of xsl:value-of() function.
    I have a table SONGS with two columns XML and XSL filled with :
    <song>
      <title>Isn't she lovely?</title>
    </song>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"></xsl:output>
      <xsl:template match="//song">
        <out>
          <xsl:value-of select="title" disable-output-escaping="yes"></xsl:value-of>
        </out>
      </xsl:template>
    </xsl:stylesheet>The query to transform XML with XSL :
    SELECT XMLTRANSFORM (xml, xsl)  FROM songs;I get this XML :
    <out>Isn&apos;t she lovely?</out>but I want that (without the '&amp;' special character) :
    <out>Isn't she lovely?</out>How can I procees to succeed ?
    Thanks,
    Dominique

    What DB version?
    The following SQL
    select xmltransform(XMLTYPE('<song>
      <title>Isn''t she lovely?</title>
    </song>'), XMLTYPE('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"></xsl:output>
      <xsl:template match="//song">
        <out>
          <xsl:value-of select="title" disable-output-escaping="yes"></xsl:value-of>
        </out>
      </xsl:template>
    </xsl:stylesheet>'))
      from dual;produces this on 11.1.0.6
    <?xml version="1.0" encoding="UTF-8"?>
    <out>Isn't she lovely?</out>and this on 10.2.0.4
    <out>Isn&apos;t she lovely?</out>I found a couple of previous discussions regarding this at
    {thread:id=679397}
    {thread:id=879301}
    The last discussion provides a workaround if you need it.

  • Problem using xsl to convert xml to xml

    I have and xml doc that has a format similar to this:
    <HEADER>
    <ORDER_NUMBER>
    <ORDER_DATE>
    <LINE>
    <LINE_NUMBER>
    <ITEM>
    </LINE>
    <LINE_NUMBER>
    <ITEM>
    </LINE>
    </HEADER>
    When I convert from xml to xml using xsl I do not get the second occurence of <LINE>, everything else looks fine.
    Please help.
    Thanks, John

    Hi John,
    I also have problems to convert xml to xml by xsl at command-line interface as follows.
    CLASSPATH=$ORACLE_HOME/rdbms/jlib/xsu12.jar:$ORACLE_HOME/lib/xmlparserv2.jar:$ORACLE_HOME/jdbc/lib/classes12.zip
    java oracle.xml.parser.v2.oraxsl source.xml -s myxsl.xsl destination.xml
    and I received error message as "Error occurred while processing myxsl.xsl: Error in expression: '*|/'."
    Actually, the source xml file and xsl script I used were copied from the book "Professional XML".
    Do you know what's the problem and could you show me setting for the classpath?
    Thanks.
    Yi

  • XSU XSLT and using xsl:include href=""

    I'm runing XDK 9.2 on an 8.1.7.4 database. I'm trying to transform the output of the XSU into a flat text file using a set of XSLT files. The main xslt includes the other xslt template files and then calls their templates by name as needed for different types of data in the XSU output.
    I have the main xslt in a table of BFILEs that I read from and pass to the DBMS_XMLQUERY.SETXSLT procedure as a CLOB. I get the following errors when I run the main procedure to generate the flat text file:
    oracle.xml.sql.OracleXMLSQLException: <Line 41, Column 35>: XSL-1002: (Error) Error while processing include XSL file (header.xslt).
    at oracle.xml.sql.query.OracleXMLQuery.setXSLT(OracleXMLQuery.java:818)
    at oracle.xml.sql.query.OracleXMLStaticQuery.setXSLT(OracleXMLStaticQuery.java:481)
    "header.xslt" is one of the included xslts. Is there some way to specify the other xslts? I have tried loading them into the BFILE table, but it still doesn't work.

    Hi I have tried out the code i.e. transforming a node and getting out a string representation. Following is code that works using JAXP apis.
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import java.io.*;
    public class XMLString {
    public void xmlInString(Document document) throws Exception{
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer =
                   tf.newTransformer();
    StringWriter stWriter = new StringWriter();
    transformer.transform(new DOMSource(document), new StreamResult(stWriter));
    String strDOM = stWriter.toString();
    System.out.println("String dom");
    StringReader strIn = new StringReader(strDOM);
    BufferedReader buffIn = new BufferedReader(strIn);
    BufferedWriter bufOut = new BufferedWriter(new FileWriter("out.txt"));
    String out = null;
    while((out=buffIn.readLine()) != null){
    bufOut.write(out, 0, out.length());
    bufOut.flush();
    bufOut.close();
    public static void main(String args[]){
    try{
    XMLString strXML = new XMLString();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource inputSource = new InputSource("input.xml");
    Document doc = db.parse(inputSource);
    strXML.xmlInString(doc);
    }catch(Exception e){
    System.out.println(e.getMessage());
    e.printStackTrace();
    I am using the xalan and xerces versions that come with the Java XML Winter pack from sun's website. The problem could lie with the underlying transformation processor you are using. It may not support transforming to a string or it could have a bug. So my advice is to find out what version transformation processor you are using. And look at the vendor's documentation to find any reference to this feature. Otherwise try using the Java XML Winter pack.

  • A peculiar problem using jsp:include conditionally

    Hi,
    This is regarding usage of jsp:include in Myfaces 1.1.4.
    lets say the page containing the jsp:include statements as PARENT PAGE
    I have a requirement to display some components in the PARENT PAGE which are continued from the same form using different JSPs since the components are different based on a condition.
    I used the following code:
    <h:panelGrid id="CandidateRequestorView" rendered="#{RgsViewRequirementBB.displayCandidateView}" columns="1">
         <jsp:include page="/RGSPages/requestorViewReq.jsp"/>
    </h:panelGrid>
    <h:panelGrid id="CandidateMatcView" rendered="#{!RgsViewRequirementBB.displayCandidateView}" columns="1">
         <jsp:include page="/RGSPages/matcViewReq.jsp"/>
    </h:panelGrid>Now if I use only 1 panel grid (any one out of the above 2) it works. I didnt even use <f:subview> any where( neither in the PARENT PAGE nor in the included jsps), but it works.... Also for your knowledge these jsps contain only JSF elements( no plain HTML code is used)
    But if I am using the above displayed code to have both the jsps (actually only one will be displayed bcoz the same condition is used)
    then its not displaying all the contents of included jsp. (YES I AM ABLE TO GET TO THE JSP...THERE IS NO ERROR) There is a datatable inside this jsp which is not rendered......
    I have used <f:subview> when i faced this problem.......
    I have tried every combination....writing <f:subview> in the PARENT PAGE ....writing in included jsps and removed it from PARENT PAGE.....also some of the articles in the forum mentioned that <f:subview> element should not be used inside <h:panelgrid> .....i even tried that....but final result is same as I was getting the first time...
    I am able to reach the jsp page (with or without <f:subview>) but i am not able to display all the contents....but if i use only one of the included jsps(by removing any one of the panel grids) I am able to view them. Since I am able to view all the contents when i view these pages inside the PARENT PAGE one at a time, that indicates there is no problem in datatable contained in these pages.....
    ( Also I have not used <f:view> inside my included jsps.)
    Please help to solve this problem...
    Thanks
    Avner

    Hi BalusC,
    The RgsViewRequirementBB is already in the session scope.
    Also I am using the setDisplayCandidateView(true) or setDisplayCandidateView(false ) explicitly as depicted below. The page is still under construction thats why the rendered attribute is explicitly set.
    public RgsViewRequirementBackingBean() {
    super();
    // TODO Auto-generated constructor stub
    try{
                setDisplayCandidateView(true);
                 // some more code goes in here
         catch(Exception){
               ResourceBundle bundle = null;
               bundle = ResourceBundle.getBundle("resources.ErrorMessages", FacesContext.getCurrentInstance().getViewRoot().getLocale());
                 //some more code goes in here
    }

  • Subtemplate problem using XSL tags.

    Hi,
    I am working on XML Publisher reports. I am using subtemplate.rtf in maintemplate.rtf, but i am ending up with warning after submitting concurrent program.
    My subtemplate.rtf: (It prints a blank row)-- I registered in INV Application and code name is GENERIC.
    <xsl:template name="countdown">
    <xsl:param name="p"/>
    <xsl:if test="$p"><xsl:call-template name="countdown"><xsl:with-param name="p" select="$p - 1"/>
    </xsl:call-template></xsl:if>
    </xsl:template>
    My maintemplate.rtf:
    <?import:xdo://INV.GENERIC.en.US?>
    [here i have some columns]
    *<xsl:call-template xdofo:ctx="inline" name="countdown">*
    *<xsl:with-param name="p" select="2"/></xsl:call-template>*
    After submitting concurrent program, it is ending with warning. Only with 'import statement', It's is not giving any error; but if i use 'call-template',it's giving warning.
    I doubt that problem with 'call-template' syntax.
    Could anybody help me in making it successful.
    Thanks.

    Hi,
    There is small correction in my 'call-template' syntax.
    *<xsl:call-template xdofo:ctx="inline" name="countdown">*
    *<xsl:with-param name="p" select="number(2)"/></xsl:call-template>*
    Thanks.

  • Problem using jdk included with JDEV9i

    I am trying to use jdk supplied with jdev9i release candidate 2 on my system
    (win 98).I have included c:\jde9i\jdk\bin in my system's path and c:\jdev9i\jdk\lib
    in my class path.
    But when I invoke compiler using javac it prints a long error message ,
    some of them are given below(I can't see the main exception because it scrolls up).
    Sun.misc.Resource Sun.misc.URLClassPath.getReasource(java.lang.String.boolean)
    java.lang.Object java.net.URLClassLoader$1.run()
    java.lang.Object java.security.AccessController.dePriviledged(java.security.
    PriviledgedExceptionAction,java.security.AccessControlContext)
    So how can I use this jdk to compile and run my other applications.

    Hi,
    My document looks as follows:
    <pre:inventory xmlns:pre="http://www.example.com/books">
    <pre:book year="2000">
    <pre:title>Snow Crash</pre:title>
    <pre:author>Neal Stephenson</pre:author>
    <pre:publisher>Spectra</pre:publisher>
    <pre:isbn>0553380958</pre:isbn>
    <pre:price>14.95</pre:price>
    </pre:book>
    <!-- more books... -->
    </pre:inventory>
    And I tried the following:
    //pre:book
    /pre:inventory and
    /pre:inventory/pre:book
    I have the necessaty code in my namespaceresolver as follows:
    public String getNamespaceURI(String prefix) {
            if (prefix == null)
                  throw new NullPointerException("Null prefix");
            else if ("pre".equals(prefix))
                   return "http://www.example.com/books";
            else if ("xml".equals(prefix))
                   return XMLConstants.XML_NS_URI;
              return XMLConstants.NULL_NS_URI;
                    cheers,
    ovisvana

  • XML/XSLT: Setting xsl:include href attribute with a variable

    I have a main layout stylesheet and depending on which page the user selects I want to use xsl:include to display the selected information in the 'content' DIV. The process works fine if hardcode it like this:
    <xsl:include href="welcome.xsl"/>
    <div id="content"
    <xsl:call-template name="welcome"/>
    </div>
    but, what I would like to do is have the name of the included template pulled from the xml file depending on which page was selected by the user. Something similar to this:
    <xsl:variable name="ss">
    <xsl:text><xsl:value-of select="root/stylesheet"/></xsl:text>
    </xsl:variable>
    <xsl:include href="{$ss}.xsl"/>
    <div id="content">
    <xsl:apply-template name="{$ss}"/>
    </div>
    So far I have tried using many different forms of code and have been unable to get this to work. Any ideas?
    EDIT: Okay, I have it partly figured out, at least why it isn't working. As far as I can tell, the 'xsl:include' tag must be a child of the 'xsl:stylesheet' tag, and is thus declared before the <xsl:template match="/"> which means it can't read the xml element to even store it in the variable. I have an idea of how to accomplish what I need, though.
    Last edited by munkyeetr (2009-01-28 03:29:58)

    I have attempted the same thing before as well. The only way I was able to dynamically build the xsl:include was to declare a new namespace e.g xmlns:out="output.xsl" in my XSL file and do something like the following:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:out="output.xsl">
    <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
    <xsl:varible name="xxx" select=" 'myFile.xsl' "/>
    <xsl:template match="/">
    <out:stylesheet version="1.0">
    <out:template match="/">
    <out:include>
    <xsl:attribute name="href">
    <xsl:value-of select="$xxx" />
    </xsl:attribute>
    </out:include>
    </out:template>
    </out:stylesheet>
    </xsl:template>
    </xsl:stylesheet>
    When applied to any valid XML document this produces the XSL file you are after as the output.
    To use this output against your intended XML source consider the following: A Java program can very quickly apply the above stylesheet to any XML source to get the output you want... then apply that XSL result to the actual XML document you are wanting to transform. From here you can do what you want with the transformed result.

  • Xsl:include not resolving no matter HOW I load the xslt

    I cannot get *<xsl:include>* to work with XMLTRANSFORM in a PL/SQL environment in Oracle 11.2.0.3. I am exclusively working inside the database.
    I have a base XSLT which includes another XSLT using xsl:include. I want to load the base XSLT as an XMLTYPE and have it transform another XML document, as if the entire XSLT were one large document.
    I have loaded the base (base.xslt), the extension (include_with_base.xslt), and the combination of the two (entire_thing.xslt) in the XDB catalog. base.xslt has this statement inside its xsl:stylesheet node, attempting to include the other xslt:
    *<xsl:include href="/public/include_with_base.xslt" />*
    I have the xslts stored in XDB. This verifies they are intact:
    1. The base xslt which has the xsl:include statement in it loads just fine.
    select xdburitype('/public/base.xslt').getXML() from dual;
    2. The extension which is the target of the include reference in the base xslt loads just fine.
    select xdburitype('/public/include_with_base.xslt').getXML() from dual;
    3. The combination of the two, where I cut-and-paste all children of xslt:stylesheet from include_with_base.xslt into the xslt:stylesheet node of base.xslt also loads just fine.
    select xdburitype('/public/entire_thing.xslt').getXML() from dual;
    However, when I try to execute a transformation of some test xml using base.xslt, it fails:
    select XMLTRANSFORM(xdburitype('/public/xml_input.xml').getXML(), xdburitype('/public/base.xslt').getXML()) FROM dual;
    When I try to execute the same transformation of the same test xml using entire_thing.xslt, it works:
    select XMLTRANSFORM(xdburitype('/public/xml_input.xml').getXML(), xdburitype('/public/entire_thing.xslt').getXML()) FROM dual;
    When I perform the transformation using altovaxml and the two xslts are in the same disk directory (and I use a relative reference with no path information rather than an absolute reference like I show in the examples above), the transformation works just fine.
    What can I do to make XMLTRANSFORM work with an XSLT that has an essential <xsl:include ... /> reference in it?
    Edited by: user11359697 on Apr 15, 2013 1:49 PM

    For fun, here's an implementation of what I would call the "poor man" include.
    The query takes the URI of the main stylesheet as input and recursively replaces all xsl:include directives with the content of the corresponding stylesheet.
    It supports relative URIs.
    Test case :
    */public/include1.xsl*
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:include href="./include2.xsl"/>
      <xsl:template name="test">
        <TEST/>
      </xsl:template>
    </xsl:stylesheet>
    {code}
    */public/include2.xsl*
    {code:xml}
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test2">
        <TEST2/>
      </xsl:template>
    </xsl:stylesheet>
    {code}
    */public/main.xsl*
    {code:xml}
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:include href="./include1.xsl"/>
      <xsl:template match="/">
        <xsl:call-template name="test"/>
      </xsl:template>
    </xsl:stylesheet>
    {code}
    and the query that rebuilds the complete stylesheet :
    {code}
    SQL> select xmlserialize(document      -- for display purpose
      2           xmlquery(
      3           'declare namespace xsl = "http://www.w3.org/1999/XSL/Transform"; (::)
      4            declare function local:include($href as xs:string) as element(xsl:stylesheet)
      5            {
      6              copy $d := fn:doc($href)/xsl:stylesheet
      7              modify (
      8                for $i in $d/xsl:include
      9                return replace node $i
    10                       with local:include(resolve-uri($i/@href, $href))/child::*
    11              )
    12              return $d
    13            }; (::)
    14            local:include($main_xsl)'
    15           passing '/public/main.xsl' as "main_xsl"
    16           returning content
    17           )
    18         indent
    19         )
    20  from dual;
    XMLSERIALIZE(DOCUMENTXMLQUERY(
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <TEST2/>
      </xsl:template>
      <xsl:template name="test" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <TEST/>
      </xsl:template>
      <xsl:template match="/">
        <xsl:call-template name="test"/>
      </xsl:template>
    </xsl:stylesheet>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • xsl:include in XSL Workshop

    I am trying to use <xsl:include> for some proxy stylesheet. I use the form
    <xsl:include href="filename.xsl" />
    I get the following error when process the stylesheet:
    'Bad URI found while including/importing file: no protocol: filename.xsl'
    Currently I am just working with the workshops, I have not deployed the xsl stilesheets yet to the server.
    Everything works as expected in XMLSpy.
    Does anybody have an example of a working <xsl:include>?

    what about putting that file in the respository? or set up the XMLDIR and put it there? I have never done it but just a though.
    Ben

  • XSL Include

    When using XSL Include, is it possible to include HTML files as well? I would like to have a common footer on all of my xsl stylesheets and was hoping xsl-include would do the trick. It will bring in the text, but it strips all the <> tags and leaves me with just plain text. Is there something I can do to the include file to preserve all the HTML tags upon inclusion via xsl-include?

    What you can do is:
    1. Create named templates for
    "header" and "footer".
    2. Put these templates in an .xsl file
    called common.xsl
    3. <xsl:include href="common.xsl"/>
    in the stylesheet where you want
    to use the common header and
    footer.
    4. Add <xsl:call-template name="header"/>
    and <xsl:call-template name="footer"/>
    at the appropriate places in your
    new stylesheet.

  • Problem in transforming xml to html using xsl

    Hi everybody ,
    I am creating a xml in memory and i want to transform using xsl into an html.
    I want to embed some html code also in the data node.But when I get the html it simply writes as it is. I tried to make it cdata section but it did not worked. Pls help.
    crypticashu
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import org.w3c.dom.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class mytemp {
         public static void main(String args[])
         DocumentBuilder builder = null;
         Document document = null;
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         try
         builder = factory.newDocumentBuilder();
         document = builder.newDocument();
         catch (ParserConfigurationException e)
         e.printStackTrace();
         Element root = (Element) document.createElement("REPORT");
         document.appendChild(root);
         Node child = document.createElement("DATA");
         CDATASection data = document.createCDATASection("<b>Hello World </b>");
         child.appendChild(data);
         root.appendChild(child);
         document.getDocumentElement().normalize();
         DOMSource domsource = new DOMSource(document);
              TransformerFactory tfactory = TransformerFactory.newInstance();
              File f = new File("c:/mytemp/report.xsl");
              StreamSource xsl = new StreamSource(f);
              File html = new File("c:/myhtml.html");
              try
                   Templates templates = tfactory.newTemplates(xsl);
                   Transformer transformer = templates.newTransformer();
                   transformer.transform(domsource, new StreamResult(html));
              catch(Exception e)
                   e.printStackTrace();
         }

    want to embed some html code also in the data node.But when I get the html it simply writes as it is.That statement contradicts:
    In real application i will be getting data containg html tags.I want the parser to read that data as simple text. Both cannot be true. You either want the HTML to not be parsed or you want the transformer to deal with it. Which one?
    - Saish

  • Problems using a php include file with an Add-on Domain.

    Hello,
    I am having an issue getting a php include file to work with a new add-on domain I am working on getting up and running.
    This include file is one that supplies the rest of the php code to a contact form page.  It works as it should for my original domain, same file no difference.  I made sure that the files hosted on the remote server had all read, write, execute permissions turned on.
    I have tried putting the include file in several different locations as a test, such as:
    I don't remember the exact name of the include file at the moment, as I'm at work so I will designate it below as 'includefile.php'.
    file path for add-on domain - ../public_html/lorentzpainting/includes/includefile.php
    alternatives I tried moving the file to - ../public_html/lorentzpainting/includefile.php
    When none of those options worked, I tried just pointing the path towards other places on the server that have the include file such as:
    ../public_html/includes/includefile.php
    ../public_html/includefile.php
    What can I do here?  Should I just give up on using the include and put all the code back in the page?  Doesn't seem like it should be this complicated, it works perfectly fine for my other site.. and still does.
    Thanks ahead of time to those who may assist me.

    here is the contents of the include file:
    <?php
    if (isset($_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'],
    '.inc.php')) exit;
    // remove escape characters from POST array
    if (PHP_VERSION < 6 && get_magic_quotes_gpc()) {
      function stripslashes_deep($value) {
        $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
        return $value;
      $_POST = array_map('stripslashes_deep', $_POST);
      // assume that there is nothing suspect
        $suspect = false;
        // create a pattern to locate suspect phrases
        $pattern = '/Content-Type:|Bcc:|Cc:/i';
          // function to check for suspect phrases
      function isSuspect($val, $pattern, &$suspect) {
        // if the variable is an array, loop through each element
        // and pass it recursively back to the same function
        if (is_array($val)) {
          foreach ($val as $item) {
            isSuspect($item, $pattern, $suspect);
        else {
          // if one of the suspect phrases is found, set Boolean to true
          if (preg_match($pattern, $val)) {
            $suspect = true;
    //check the $_POST array and any subarrays for suspect content
    isSuspect($_POST, $pattern, $suspect);
        if (!empty($_POST['url'])) {
            $suspect = true;
        if ($suspect) {
            $mailSent = false;
            unset($missing);
        } else {
        //process the $_POST variables
        foreach ($_POST as $key => $value) {
            // assign to temporary variable and strip whitespace if not an array
            $temp = is_array($value) ? $value : trim($value);
            // if empty and required, add to $missing array
            if (empty($temp) && in_array($key, $required)) {
                array_push($missing, $key);
            } elseif (in_array($key, $expected)) {
                // otherwise, assign to a variable of the same name as $key
                ${$key} = $temp;
        //validate the email address
        if (!empty($email)) {
            // regex to identify illegal characters in email address
    $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
    //reject the email address if it doesn't match
    if (!preg_match($checkEmail, $email)) {
        $suspect = true;
        $mailSent = false;
        unset($missing);
    //go ahead only if all required fields OK
        if (!$suspect && empty($missing)) {
    //initialize the $message variable
            $message = '';
    // loop through the $expected array
            foreach($expected as $item) {
    // assign the value of the current item to $val
                if (isset(${$item}) && !empty(${$item})) {
                    $val = ${$item};
                } else {
    // if it has no value, assign 'Not selected'
                    $val = 'Not selected';
    // if an array, expand as comma-sparated string
                if (is_array($val)) {
                    $val = implode(',', $val);
    // add label and value to the message body
      $message .= ucfirst($item).": $val\r\n\r\n";
    //limit line length to 70 characters
        $message = wordwrap($message, 70);
    //create Reply-To header
        if (!empty($email)) {
            $headers .= "\r\nReply-To: $email";
    // send it
        $mailSent = mail($to, $subject, $message, $headers);
        if ($mailSent) {
    // $missing is no longer needed if the email is sent, so unset it
            unset($missing); echo('Thank you for contacting Common Wealth Web Solutions');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    </body>
    </html>

Maybe you are looking for