Re: View references

"Taavi Tiirik" <[email protected]>
Newsgroups gmane.comp.web.maverick.general
Message-ID <00f601c2f77a$f5b9a3d0$0201000a@mii>
MessageSimen,

This is my maverick.xsl file that adds a view named "authentication" to every protected command.

<command name="..." protected="true">
   ...
</command>

But yes, i think it would make sense to modify view lookup code to search from amongst global view definitions as well. Would it break anything?

with best wishes,
Taavi

  ----- Original Message ----- 
  From: jim moore 
  To: [email protected] 
  Sent: Sunday, March 30, 2003 9:30 PM
  Subject: RE: [Mav-user] View references


  if you want behavior where the global views are referenced by all commands, you can use a transformation on maverick.xml. if specified, maverick will run maverick.xml through an xsl before loading it. This xsl could easily copy all global views for you under each command. actually--this has come up so often on this list that someone may have already written an xsl to do this.

  --jim
maverick.xsl (text/xml, 1 KB)
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" version="1.0" indent="yes"/>

<!-- First of all, copy the root and apply-templates -->
<xsl:template match="/">
	<xsl:copy>
		<!-- this copies the attributes(if any) of the root element -->
		<xsl:copy-of select="@*"/>
		<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>

<!-- This will match any other elements, copy them and their attribute nodes
and apply-templates -->
<xsl:template match="*">
	<xsl:copy>
		<!-- this copies the attributes(if any) of the element -->
		<xsl:copy-of select="@*"/>
		<xsl:apply-templates/>
	</xsl:copy>
</xsl:template>

<!-- This will add authentication view to every command that is defined with
protected='true' attribute -->
<xsl:template match="command[@protected='true']">
	<command>
		<!-- this copies across elementA's attributes -->
		<xsl:copy-of select="@*"/>
		<xsl:apply-templates/>
		<view name="authentication" ref="authentication"/>
	</command>
</xsl:template>

</xsl:stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.