xsl-list
[Top] [All Lists]

RE: apply templates on a variable

2003-06-30 15:28:19
Is is possible to apply templates to the contents of a 
variable? I know this is kind of going backwards, 

It is possible to apply-templates to a node-set held in a variable. But
what makes you think this is "going backwards"? It just means that the
template rules will take their input from the nodes in that variable.
The output of the templates will go to the result tree in the normal
way.

Unfortunately you describe what you are trying to do in terms of code
which you seem unsure of. This makes it impossible for me to guess what
you are really trying to achieve.

Michael Kay



but 
assuming I cannot mess with the input XML is there anyway to 
do the following:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:xs="http://www.w3.org/2001/XMLSchema";

      <xsl:output method="xml" indent="yes" encoding="utf-8"/>
      <xsl:strip-space elements="*"/>
      
      <xsl:include 
href="file:///home/rob/programs/include/docbook1_60_1/html/doc
book.xsl"
/>
      <xsl:variable name="testfile" 
select="document('/mnt/fileserver/projects/fodder/faq_docbook.
xml')" />
      
      <xsl:template match="/request">
              <!-- I know this isn't correct, but I would like to
              "copy" the variable to the *input* document or something
              there abouts -->
              <xsl:copy-of select="$testfile" />
              <!-- where now these would apply -->
              <xsl:apply-templates />
      </xsl:template>
      
</xsl:stylesheet>

I looked in the FAQ but didn't see anything that seemed 
relevant. (probably because it is not possible :) )

p.s. they are not named templates

Thanks,
Rob


-- 
Rob Rohan <me(_at_)robrohan(_dot_)com>


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



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



<Prev in Thread] Current Thread [Next in Thread>