Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Xsl value-of and apply-templates problems

0 views
Skip to first unread message

Neil Rickus

unread,
Aug 6, 2001, 7:47:04 AM8/6/01
to
I am having problems with xsl. I am using XML to describe a function
in Visual C. To avoid having to type in the program code twice, the
arguments are first output to look like program code, then later
output again when being described.

The stylesheet performs the transformation using xs:value-of. Because
of this, when I wish to specify elements that are within elements,
such as emphasised text or a hyperlink (as seen below), it does not
work due to xsl:apply-templates not being used.

Is there any way round this?

Thanks very much for your help,

Neil

XML:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Neil
Rickus (Rockliffe) -->
<?xml-stylesheet type="text/xsl" href="Function-New.xsl"?>
<SDKPage>

<functionGroup>
<functionGroupName>Opening and Closing Mailboxes </functionGroupName>

<function>
<functionInfo>
<functionName>CloseMailbox</functionName>
<typeResult>BOOL</typeResult>
</functionInfo>

<arguments>
<argument>
<argName>h</argName>
<argType>tMailboxHandle</argType>
<argDesc>Handle returned from a prior successful call to
<linkInfo><linkhref>http://www.rockliffe.com</linkhref>
<link> OpenMailbox</link>
</linkInfo>
</argDesc>
</argument>

<functionDesc>Closes a previously opened mailbox.
</functionDesc>
</arguments>

<result>
<resultDesc>Returns TRUE on success, FALSE on failure. Use
<emphasis> GetLastError </emphasis>to determine the cause of
failure.</resultDesc>
<functionComment/>
</result>

</function>
</functionGroup>
</SDKPage>


XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="functionInfo">
<html>
<head>
<title>MailSite v5 SDK</title>
</head>
<p/>
<h1>
<xsl:value-of select="functionName"/>
</h1>
<xsl:value-of select="typeResult"/><xsl:text> </xsl:text>
<xsl:value-of select="functionName"/><xsl:text> ( </xsl:text>
</html>
</xsl:template>

<xsl:template match="linkInfo">
<a>
<xsl:attribute name="HREF">
<xsl:value-of select="linkhref"/>
</xsl:attribute>
<xsl:value-of select="link"/>
<xsl:apply-templates/>
</a>
</xsl:template>

<xsl:template match="emphasis">
<b><xsl:apply-templates/></b>
</xsl:template>

<xsl:template match="arguments">
<xsl:for-each select="//argument">
<br/>
<xsl:value-of select="argType"/><xsl:text> </xsl:text>
<xsl:value-of select="argName"/>
</xsl:for-each>
<xsl:text> );</xsl:text><br/>
<br/><xsl:value-of select="functionDesc"/><br/>

<p></p><h3><i>Arguments</i></h3>
<xsl:for-each select="//argument">
<xsl:value-of select="argName"/><br/>
<xsl:value-of select="argDesc"/><br/><br/>
</xsl:for-each>

<br/>
</xsl:template>

<xsl:template match="result">
<p></p><h3><i>Results</i></h3>
<xsl:value-of select="resultDesc"/><br/><br/>
<xsl:for-each select="//error">
<xsl:value-of select="errorNo"/><br/>
<xsl:value-of select="errorDesc"/><br/><br/>
</xsl:for-each>

<p></p><h3><i>Comments</i></h3>
<xsl:value-of select="functionComment"/><br/><br/>
</xsl:template>

</xsl:stylesheet>

0 new messages