You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by le...@daou.co.kr on 2000/08/18 04:32:52 UTC

a importing question

The output from a source that has a import statement is different from one from a source without the stamement.
The imported file, lwcsehead2.xsl is not relevant to the importing file. There are some variables in the imported file.
The second output is what I wanted.
How can I get the second output with the import statement?

===============================================================================
output with <xsl:import href="lwcsehead2.xsl"/>
-------------------------------------------------------------------------------
count test 
0
node set test


economics TEST Kim P PROF Lee S STUD first project 1 

===============================================================================
output without <xsl:import href="lwcsehead2.xsl"/>
-------------------------------------------------------------------------------
count test 
3
node set test
information

economics TEST Kim P PROF Lee S STUD first project 1 

================================================================================
lwsample2.xsl
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" 
xmlns:lwhead2="headinfo.uri"
exclude-result-prefixes="lwhead2"
>

<xsl:import href="lwcsehead2.xsl"/>

<lwhead2:items>
<lwhead2:item>home</lwhead2:item>
<lwhead2:item>information</lwhead2:item>
<lwhead2:item>statistics</lwhead2:item>
</lwhead2:items>

<xsl:template match="lwml">
<xsl:processing-instruction name="cocoon-format">
type="text/html/loose"
</xsl:processing-instruction>
<html>
<body> 
count test <br/>
<xsl:value-of select="count(document('')//lwhead2:items/lwhead2:item)"/><br/>
node set test<br/>
<xsl:value-of select="document('')//lwhead2:items/lwhead2:item[2]"/><br/>
<br/>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
==============================================================================
lwcsehead2.xsl
------------------------------------------------------------------------------
<?xml version="1.0" encoding="euc-kr" ?>

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

<xsl:variable name="bodybgcolor">white</xsl:variable>

<xsl:variable name="bodytext">black</xsl:variable>

<xsl:variable name="bodylink">blue</xsl:variable>

<xsl:variable name="bodyvlink">purple</xsl:variable>

<xsl:variable name="bodyalink">red</xsl:variable>

</xsl:stylesheet>
==============================================================================
lwsample.xml
------------------------------------------------------------------------------
<?xml version="1.0" encoding="euc-kr"?>
<?xml-stylesheet href="lwsample2.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<lwml>

 <course>
    <name>economics</name>
    <code>TEST</code>
 </course>

 <user>
    <name>Kim</name>
    <kind>P</kind>
    <id>PROF</id>
 </user>

 <user>
    <name>Lee</name>
    <kind>S</kind>
    <id>STUD</id>
 </user>

 <project>
  <name>first project</name>
  <no>1</no>
 </project>

</lwml>
==================================================================================