Click here to Skip to main content
15,917,456 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralServer side Pin
Paul Watson23-Mar-03 22:28
sitebuilderPaul Watson23-Mar-03 22:28 
GeneralRe: Server side Pin
xxhimanshu23-Mar-03 22:53
xxhimanshu23-Mar-03 22:53 
GeneralRe: Server side Pin
Philip Fitzsimons26-Mar-03 3:04
Philip Fitzsimons26-Mar-03 3:04 
GeneralProblem while using MSXML to get HTTP response Pin
adapterJohn18-Mar-03 23:05
adapterJohn18-Mar-03 23:05 
GeneralRe: Problem while using MSXML to get HTTP response Pin
adapterJohn20-Mar-03 21:27
adapterJohn20-Mar-03 21:27 
Generalstrong type in XML Pin
Michal Januszczyk15-Mar-03 5:57
sussMichal Januszczyk15-Mar-03 5:57 
Questioncan XSL do this ? Pin
act_x14-Mar-03 5:25
act_x14-Mar-03 5:25 
AnswerRe: can XSL do this ? Pin
Torsten Mauz14-Mar-03 15:14
Torsten Mauz14-Mar-03 15:14 
Hi,

here's an example of this I knocked together for a friend a while ago..

*********XML*********
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="xmlnav.xsl"?>

<navigation>
<menu name="menu 1">
<option name="LEVEL 1" path="/xmlnav/level1.asp">
<option name="test level 1" path="/xmlnav/level1test.asp">
<option name="test level 1 sub option" path="/xmlnav/suboption.asp"/>
<option name="test level 1 sub option 2" path="/xmlnav/level1test.asp">
<option name="test level 1 sub sub option" path="/xmlnav/suboption.asp"/>
</option>
</option>
<option name="test level 2" path="/xmlnav/level2test.asp"/>
<option name="test level 3" path="/xmlnav/level3test.asp"/>
</option>
</menu>
<menu name="menu 2">
<option name="LEVEL 2" path="/xmlnav/level2.asp">
<option name="test menu2 sub option" path="/xslnav/suboption2.asp"/>
</option>
</menu>
</navigation>


---------------8<---------------
*********XSL*********

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

<xsl:output method="html" encoding="iso-8859-1"/>
<xsl:param name="path"/>

<xsl:template match="/">
<html>
<head>
<style type="text/css">
body, td { font-family: arial; font-size: 12px }
</style>
</head>
<body>

<p>Matching company: <xsl:value-of select="$path"/></p>

<xsl:for-each select="navigation/menu">
<xsl:value-of select="@name"/><br/>
<xsl:for-each select="child::option">
<xsl:call-template name="alink">
<xsl:with-param name="nesting" select="0" />
<xsl:with-param name="loop" select="0" />
</xsl:call-template>
<br />
<xsl:call-template name="chld" >
<xsl:with-param name="nesting" select="0" />
<xsl:with-param name="loop" select="0" />
</xsl:call-template>

</xsl:for-each>
<br />
</xsl:for-each>
</body>
</html>
</xsl:template>

<xsl:template name="chld">
<xsl:param name="loop" />
<xsl:param name="nesting" />

<xsl:for-each select="child::option">
<xsl:call-template name="alink">
<xsl:with-param name="loop" select="$loop" />
<xsl:with-param name="nesting" select="$nesting + 1" />
</xsl:call-template>
<br />
<xsl:call-template name="chld">
<xsl:with-param name="loop" select="$loop" />
<xsl:with-param name="nesting" select="$nesting + 1" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>

<xsl:template name="space">

</xsl:template>

<xsl:template name="alink">
<xsl:param name="loop" />
<xsl:param name="nesting" />

<xsl:if test="not($loop > $nesting)">
&#160;&#160;&#160;&#160;
<xsl:call-template name="alink">
<xsl:with-param name="loop" select="$loop + 1"/>
<xsl:with-param name="nesting" select="$nesting"/>
</xsl:call-template>
</xsl:if>

<xsl:if test="$loop=$nesting">
<a>
<xsl:attribute name="href"><xsl:value-of select="@path"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
---------------8<---------------

that should be more than enough to get you going Smile | :)

if you need an explanation then give me a shout, and I will do my humble best to clarify it.

HTH
GeneralRe: Tree Navigation Pin
act_x13-Mar-03 11:25
act_x13-Mar-03 11:25 
GeneralRe: Tree Navigation Pin
Michael A. Barnhart13-Mar-03 12:15
Michael A. Barnhart13-Mar-03 12:15 
GeneralTree Navigation Pin
act_x13-Mar-03 10:13
act_x13-Mar-03 10:13 
GeneralRe: Tree Navigation Pin
Michael A. Barnhart13-Mar-03 11:12
Michael A. Barnhart13-Mar-03 11:12 
GeneralDisplay multipal XML files using single XXLT Pin
swaps13-Mar-03 0:54
swaps13-Mar-03 0:54 
GeneralStoring data in "ref" element Pin
EnkelIk5-Mar-03 7:18
EnkelIk5-Mar-03 7:18 
GeneralCan't define array in xml Pin
EnkelIk3-Mar-03 2:18
EnkelIk3-Mar-03 2:18 
GeneralThe real schema Pin
EnkelIk3-Mar-03 2:20
EnkelIk3-Mar-03 2:20 
GeneralRe: The real schema Pin
Louis Riel2-Jun-04 4:49
Louis Riel2-Jun-04 4:49 
GeneralRe: The real schema Pin
EnkelIk8-Jun-04 23:34
EnkelIk8-Jun-04 23:34 
GeneralSOAP Stars Pin
Steve Murrell2-Mar-03 5:30
Steve Murrell2-Mar-03 5:30 
Generalxsl:import and xsl:include Pin
Philip Patrick28-Feb-03 21:11
professionalPhilip Patrick28-Feb-03 21:11 
GeneralRe: xsl:import and xsl:include Pin
Michael A. Barnhart1-Mar-03 1:34
Michael A. Barnhart1-Mar-03 1:34 
GeneralRe: xsl:import and xsl:include Pin
Philip Patrick1-Mar-03 1:46
professionalPhilip Patrick1-Mar-03 1:46 
GeneralRe: xsl:import and xsl:include Pin
Michael A. Barnhart1-Mar-03 1:51
Michael A. Barnhart1-Mar-03 1:51 
GeneralRe: xsl:import and xsl:include Pin
Philip Patrick1-Mar-03 2:00
professionalPhilip Patrick1-Mar-03 2:00 
QuestionHow to get AppInfo/Documentation from an XML Schema via XmlDocument (DOM) in C#? Pin
Mirco J. Nimmrichter27-Feb-03 6:02
Mirco J. Nimmrichter27-Feb-03 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.