[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

xsl:apply-tempaltes with select matching


Subject: xsl:apply-tempaltes with select matching
From: "Brett McLaughlin" <bmclaugh@xxxxxxxx>
Date: Wed, 8 Dec 1999 11:35:37 -0600

I have the following XML document:

<?xml version="1.0"?>
<?xml-stylesheet href="xsl/portal-html.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>

<Portal:Page xmlns:Portal="http://url.com">
  <!-- User Specific Information -->
  <Portal:User>
  </Portal:User>

  <!-- Global Preferences Information -->
  <Portal:Preferences>
   <Portal:widgetColor></Portal:widgetColor>
   <Portal:widgetHighlightColor></Portal:widgetHighlightColor>
   <Portal:trimColor>#006699</Portal:trimColor>
   <Portal:trimFontColor>Silver</Portal:trimFontColor>
   <Portal:fontFace>Arial</Portal:fontFace>
  </Portal:Prefereces>

  <!-- Screen preferences information -->
  <Portal:ScreenPreferences>
   <Portal:Screen>
    <Portal:screenTitle>Portal</Portal:screenTitle>
    <Portal:screenColor>#FFCC66</Portal:screenColor>
   </Portal:Screen>
  </Portal:ScreenPreferences>

  <!-- Now deal with the actual outputted content -->
  <Portal:Content>
   <Portal:Header>
    Header
   </Portal:Header>
   <Portal:Body>
     Body
   </Portal:Body>
   <Portal:Footer>
     Footer
   </Portal:Footer>
  </Portal:Content>

</Portal:Page>

I want to process the Portal:Content tag only, and use the rest of the
information as variables.  I has thought to have a stylesheet like so:

<?xml version="1.0"?>

<!-- Written by Brett McLaughlin "bmclaugh@xxxxxxxx" -->

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

  <xsl:template match="Portal:Page">
   <xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
    <head>
     <title>
      Allegiance Portal -
     </title>
    </head>
    <body bgcolor="#ffffff" marginwidth="5" marginheight="5" topmargin="5"
leftmargin="5">
     <xsl:apply-templates select="Portal:Content"/>
    </body>
   </html>
  </xsl:template>

  <xsl:template match="Portal:Content">
   <xsl:apply-templates/>
  </xsl:template>

And then go on an handle each child element of Portal:Content.  However,
this doesn't work; the Portal:Content match never occurs.  If I take off the
select="Portal:Content" portion of <xsl:apply-templates> in the Portal:Page
section, it then does match Portal:Content, but nothing else.  If someone
could let me know what I'm doing wrong, I'd appreciate it.  I'm also not
sure this is the best way to accomplish this particular task, so any
suggestions are welcome - the other XML data is used throughout the
document, so I don't want to localize it within sections of the XML content.

Thanks,
Brett


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



Current Thread
Keywords
xml