This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl and <Div> tags - urgent please help
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 24 May 2002 00:27:49 +0200
- Subject: Re: [xsl] xsl and <Div> tags - urgent please help
- References: <LLCJGCKLAPFCJAAA@mailcity.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
I can't help you with the script - that's not my favourite ;-)
But there are still a few errors.
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:foo="http://www.proquestconnect.com/mynamespace" version="1.0">
The namespace must exactly be written
"http://www.w3.org/1999/XSL/Transform".
> <xsl:output method="html" version="4.0" media-type="text/html" indent="yes" encoding="iso8859-1"/>
encoding="ISO-8859-1"
^
> <msxsl:script implements-prefix="foo">
>
> var nodeInfo = null; // to store node information
> var prevNodeInfo; // to store previous node's information
> var nodeInformation = null; // stores the nodeInfo from previous node
>
> function isType(node) {
> prevNodeInfo = nodeInformation;
> var isType = (node.getAttribute("name").charAt(0) == 'T');
> if(isType)
> {
> fullName(this);
>
> }
> return isType;
> }
>
> function isMethod(node)
> {
> var name = node.getAttribute("name");
> var isMethod;
> if( name.indexOf("op_") >= 0 )
> return false;
> else
> {
> isMethod = (node.getAttribute("name").charAt(0) == 'M');
> if(isMethod)
> memberName(this);
> return isMethod;
>
> }
>
>
> }
>
> function isOperator(node)
> {
> var name = node.getAttribute("name");
> if( name.indexOf("op_") >= 0 )
> return true;
> return false;
> }
>
> function getOperatorName(node) {
> var returnName = "";
> var name = node.getAttribute("name");
> var beginOp = name.indexOf("op_") ;
> var endOp = name.indexOf( "(");
> nodeInfo = name.substring(beginOp+3, endOp);
> return name.substring(beginOp+3, endOp);
> }
>
> function isProperty(node)
> {
> var isProperty = node.getAttribute("name").charAt(0) == 'P';
> if(isProperty)
> memberName(this);
> return isProperty;
> }
>
> function isDisplayed(node)
> {
>
> var accNode = node.getElementsByTagName("access").item(0);
> var type = accNode.getAttribute("type");
> if(type == "public")
> return true;
> else
> return false;
>
> }
>
> function isField(node)
> {
> var isField = (node.getAttribute("name").charAt(0) == "F");
> if(isField)
> memberName(this);
> return isField;
> }
>
> function crefName(node) {
> nodeInfo = node.getAttribute("cref").substr(2);
> return nodeInfo;
> }
>
> function fullName(node) {
> nodeInfo = node.getAttribute("name").substr(2);
> nodeInformation = nodeInfo;
> return nodeInfo;
> }
>
> function memberName(node)
> {
> var name = node.getAttribute("name").substr(2);
> var p = name.indexOf("#ctor");
> if (p >= 0) {
> basename = name.substr(0, p - 1);
> var params = name.substr(p + 5);
> if (params == "") params = "()";
> nodeInfo = basename.substr(basename.lastIndexOf(".") + 1) + params;
> return nodeInfo;
> }
> else {
> var p = name.indexOf("(");
> var params;
> var basename;
>
> if (p == -1)
> p = name.length + 1;
>
> basename = name.substr(0, p);
> var member = basename.substr(basename.lastIndexOf(".") + 1);
> nodeInfo = member + name.substr(p);
> return nodeInfo;
> }
> }
> </msxsl:script>
> <xsl:template match="/">
> <xsl:apply-templates select="doc" />
> </xsl:template>
> <xsl:template match="doc">
> <HTML>
> <HEAD>
> <TITLE>
> <xsl:value-of select="assembly/name" />
> </TITLE>
> <LINK rel="stylesheet" type="text/css" href="doc.css" />
> </HEAD>
> <BODY>
> <img src="VCLogo.gif" alt="Visual C++ Developer's Journal Logo" />
> <xsl:apply-templates select="members/member" />
> </BODY>
> </HTML>
> </xsl:template>
> <xsl:template match="member">
> <xsl:choose>
> <xsl:when expr="foo:isType(this)">
With the standardization of some xsl-elements changed. For example it
must be <xsl:when test="foo:isType(this)"/>.
> <xsl:if test="access">
> <xsl:choose>
> <xsl:when expr="foo:isDisplayed(this)">
> <xsl:apply-templates select="a" />
> <msxsl:script>
> if(prevNodeInfo != null)
> document.write("</DIV>");
> </msxsl:script>
>
> <a href="#" onClick="if( window.document.all.item(nodeInfo.toString()).style.visibility == 'visible')
> {
> window.document.all.item(nodeInfo.toString()).style.visibility == 'hidden';
>
> }
> else
> {
> window.document.all.item(nodeInfo.toString()).style.visibility == 'visible';
>
> }">
> <h1>
> <xsl:eval>nodeInfo</xsl:eval>
<xsl:eval> doesn't exist anymore. Use <xsl:value-of select="..."/>
instead, but I don't know how to combine that with msxml script. Maybe
it's easier to convert your stylesheet from WD-XSL to XSLT via the MS
converter:
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/540/msdncompositedoc.xml
Hope this helps a bit,
Joerg
> </h1>
> </a>
> <msxsl:script>
> document.write("<DIV id=" +nodeInfo +">");
> </msxsl:script>
> <xsl:apply-templates select="summary" />
> <xsl:apply-templates select="remarks" />
> <xsl:apply-templates select="example" />
> <xsl:if test="seealso">
> <h4>See Also</h4>
> <xsl:apply-templates select="seealso" />
> </xsl:if>
> <xsl:apply-templates select="members/member" />
> </xsl:when>
> </xsl:choose>
> </xsl:if>
> </xsl:when>
> <xsl:when expr="foo:isMethod(this)">
> <xsl:if test="access">
> <xsl:choose>
> <xsl:when expr="foo:isDisplayed(this)">
> <xsl:apply-templates select="a" />
> <h2>
> <xsl:eval>nodeInfo</xsl:eval> method</h2>
> <xsl:apply-templates select="summary" />
> <xsl:if test="param">
> <h4>Parameters</h4>
> <dl>
> <xsl:apply-templates select="param" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="returns" />
> <xsl:if test="exception">
> <h4>Exceptions</h4>
> <dl>
> <xsl:apply-templates select="exception" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="remarks" />
> <xsl:apply-templates select="example" />
> <xsl:if test="seealso">
> <h4>See Also</h4>
> <xsl:apply-templates select="seealso" />
> </xsl:if>
> </xsl:when>
> </xsl:choose>
> </xsl:if>
> </xsl:when>
> <xsl:when expr="foo:isOperator(this)">
> <xsl:apply-templates select="a" />
> <h2>
> <xsl:eval> getOperatorName(this) </xsl:eval> operator
> </h2>
> <xsl:apply-templates select="summary" />
> <xsl:if test="param">
> <h4>Parameters</h4>
> <dl>
> <xsl:apply-templates select="param" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="returns" />
> <xsl:if test="exception">
> <h4>Exceptions</h4>
> <dl>
> <xsl:apply-templates select="exception" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="remarks" />
> <xsl:apply-templates select="example" />
> <xsl:if test="seealso">
> <h4>See Also</h4>
> <xsl:apply-templates select="seealso" />
> </xsl:if>
> </xsl:when>
> <xsl:when expr="foo:isProperty(this)">
> <xsl:if test="access">
> <xsl:choose>
> <xsl:when expr="isDisplayed(this)">
> <xsl:apply-templates select="a" />
> <h2>
> <xsl:eval>nodeInfo</xsl:eval> property
> </h2>
> <xsl:apply-templates select="summary" />
> <xsl:if test="param">
> <h4>Parameters</h4>
> <dl>
> <xsl:apply-templates select="param" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="value" />
> <xsl:if test="exception">
> <h4>Exceptions</h4>
> <dl>
> <xsl:apply-templates select="exception" />
> </dl>
> </xsl:if>
> <xsl:apply-templates select="remarks" />
> <xsl:apply-templates select="example" />
> <xsl:if test="seealso">
> <h4>See Also</h4>
> <xsl:apply-templates select="seealso" />
> </xsl:if>
> </xsl:when>
> </xsl:choose>
> </xsl:if>
> </xsl:when>
> <xsl:when expr="foo:isField(this)">
> <xsl:if test="access">
> <xsl:choose>
> <xsl:when expr="isDisplayed(this)">
> <xsl:apply-templates select="a" />
> <h2>
> <xsl:eval>nodeInfo</xsl:eval> field
> </h2>
> <xsl:apply-templates select="summary" />
> <xsl:apply-templates select="value" />
> <xsl:apply-templates select="remarks" />
> <xsl:apply-templates select="example" />
> <xsl:if test="seealso">
> <h4>See Also</h4>
> <xsl:apply-templates select="seealso" />
> </xsl:if>
> </xsl:when>
> </xsl:choose>
> </xsl:if>
> </xsl:when>
> </xsl:choose>
> </xsl:template>
> <xsl:template match="access">
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="summary">
> <p>
> <xsl:apply-templates />
> </p>
> </xsl:template>
> <xsl:template match="param">
> <dt>
> <i>
> <xsl:value-of select="@name" />
> </i>
> </dt>
> <dd>
> <xsl:apply-templates />
> </dd>
> </xsl:template>
> <xsl:template match="value">
> <h4>Value</h4>
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="returns">
> <h4>Returns</h4>
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="exception">
> <dt>
> <i>
> <xsl:eval>crefName(this)</xsl:eval>
> </i>
> </dt>
> <dd>
> <xsl:apply-templates />
> </dd>
> </xsl:template>
> <xsl:template match="remarks">
> <h4>Remarks</h4>
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="example">
> <h4>Example</h4>
> <xsl:apply-templates />
> </xsl:template>
> <xsl:template match="seealso">
> <br />
> <a>
> <xsl:attribute name="href">#<xsl:value-of select="@cref" /></xsl:attribute>
> <xsl:apply-templates select="text()" />
> </a>
> </xsl:template>
> <xsl:template match="text()">
> <xsl:value-of />
> </xsl:template>
> <xsl:template match="para">
> <p>
> <xsl:apply-templates />
> </p>
> </xsl:template>
> <xsl:template match="code">
> <pre>
> <xsl:value-of />
> </pre>
> </xsl:template>
> <xsl:template match="see">
> <link>
> <xsl:attribute target="href">#<xsl:value-of select="@cref" /></xsl:attribute>
> <xsl:apply-templates select="text()" />
> </link>
> </xsl:template>
> <xsl:template match="list">
> <table>
> <xsl:apply-templates />
> </table>
> </xsl:template>
> <xsl:template match="listheader">
> <tr>
> <xsl:apply-templates />
> </tr>
> </xsl:template>
> <xsl:template match="item">
> <tr>
> <xsl:apply-templates />
> </tr>
> </xsl:template>
> <xsl:template match="term">
> <td>
> <xsl:apply-templates />
> </td>
> </xsl:template>
> <xsl:template match="description">
> <td>
> <xsl:apply-templates />
> </td>
> </xsl:template>
> <xsl:template match="i">
> <i>
> <xsl:apply-templates />
> </i>
> </xsl:template>
> <xsl:template match="b">
> <b>
> <xsl:apply-templates />
> </b>
> </xsl:template>
> <xsl:template match="c">
> <code>
> <xsl:apply-templates />
> </code>
> </xsl:template>
> <xsl:template match="a">
> <a>
> <xsl:attribute name="name">
> <xsl:value-of select="@cref" />
> </xsl:attribute>
> </a>
> </xsl:template>
> <xsl:template match="paramref">
> <i>
> <xsl:value-of select="@name" />
> </i>
> </xsl:template>
> </xsl:stylesheet>
>
>
> Thanks for your help.
> Aparna
>
>
> --
>
> On Thu, 23 May 2002 20:38:07
> Joerg Heinicke wrote:
>
>>Again a problem with WD-XSL, change to XSLT standard. A <xsl:script/>
>>doesn't exist. And where do you want to write the closing </DIV>? Either
>>you put it out as normal Javascript (with escaping the <, not the /):
>>
>><xsl:text>document.write("</DIV>");</xsl:text>
>>
>>or you do it with normal XML. But for help with this you must provide
>>more information. And change your xsl-namespace to
>>"http://www.w3.org/1999/XSL/Transform".
>>
>>Regards,
>>
>>Joerg
>>
>>Aparna Konduri schrieb:
>>
>>>Thanks. Can I know why the following gives an error? How to close a tag inside <xsl:script>?
>>>
>>><xsl:script>
>>>document.write("<\/DIV>");
>>></xsl:script>
>>
>>
>>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>>
>>
>
>
>
> ________________________________________________________
> Outgrown your current e-mail service?
> Get a 25MB Inbox, POP3 Access, No Ads and No Taglines with LYCOS MAIL PLUS.
> http://login.mail.lycos.com/brandPage.shtml?pageId=plus
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list