Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace element text

Status
Not open for further replies.

revox

Programmer
Feb 6, 2002
1
FI
i'm looking for a way replace the texts (|mista| , |mihin| and |tieto1|) in the element <ltype>
with the following link information

<a target=&quot;A3&quot;>
<xsl:attribute name=&quot;href&quot; >
lock_004.asp?key=
<xsl:value-of select=&quot;frompos&quot; />
</xsl:attribute>
<xsl:value-of select=&quot;frompos&quot; />
</a>

so to replace if it exist
|mista| --> <frompos> element information
|mihin| --> <fromname> element information
|tieto1| --> <data1> element information

the xml-document is produced with asp directly from the server database, so it doesn't exist in the server. the links between the documents would create a new document directly from the database and the key value for the
lock_004.asp?key would be the <frompos> element value.

<?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?>
<?xml:stylesheet type=&quot;text/xsl&quot; href=&quot;lock_loop_004.xsl&quot;?>
<loop>

<loopdata>
<posno>455-567</posno>
<posname>Rejektipumppu</posname>
<lintention>Pumppaa rejektin massatorniin</lintention>
</loopdata>

<inlock>
<interlock lmtype=&quot;LM&quot;>LM</interlock>
<id>3</id>
<active>2</active>
<ltype ltype=&quot;LM02&quot;>|mista| pysähtyminen käynnistää |mihin| viiveellä |tieto1|</ltype>
<frompos>455-322</frompos>
<fromname>Siirtoruuvi 1</fromname>
<topos>455-567</topos>
<toname>Rejektipumppu</toname>
<data1>1</data1>
<data2>seis</data2>
<data3></data3>
</inlock><br/>

<inlock>
<interlock lmtype=&quot;LM&quot;>LM</interlock>
<id>6</id>
<active>3</active>
<ltype ltype=&quot;LM03&quot;>|mista| pysähtyminen lukitsee |mihin| seis</ltype>
<frompos>455-323.1</frompos>
<fromname>Siirtoruuvi 3_1</fromname>
<topos>455-567</topos>
<toname>Rejektipumppu</toname>
<data1>1</data1>
<data2>seis</data2>
<data3></data3>
</inlock><br/>
</loop>

I try put in the replacing codes for the examples, but still confused how to do it

<?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?>
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;<xsl:eek:utput method=&quot;html&quot; indent=&quot;yes&quot; encoding=&quot;iso-8859-1&quot;/>

<xsl:template match=&quot;/&quot;>
<html>
<head>
</head>
<body>
<h2><xsl:value-of select=&quot;//posno&quot; /> <xsl:value-of select=&quot;//posname&quot; /></h2>
<table border=&quot;0&quot; borderwidth=&quot;1&quot;>
<tr STYLE=&quot;display:inline; color:black;font-size: 12pt;&quot;>
<td width='150' STYLE=&quot;display:inline; color:black; font-size: 14pt;&quot;><b>Tarkoitus:</b></td><td><xsl:value-of select=&quot;//lintention&quot; /></td>
</tr>
</table>

<table border=&quot;0&quot; borderwidth=&quot;1&quot;>
<tr STYLE=&quot;display:inline; color:black;font-size: 14pt;&quot;>
<td><b>Lukitukset:</b></td>
</tr>
<tr></tr>
<xsl:for-each select=&quot;loop/inlock[interlock='LM']&quot;>
<xsl:sort select=&quot;frompos&quot;/>
<tr STYLE=&quot;display:inline; color:black;font-size: 12pt;&quot;>
<td>
<a target=&quot;A3&quot;>
<xsl:attribute name=&quot;href&quot; >
lock_004.asp?key=
<xsl:value-of select=&quot;frompos&quot; />
</xsl:attribute>
<xsl:value-of select=&quot;frompos&quot; /></a>
 <xsl:value-of select=&quot;fromname&quot;/>
 <xsl:value-of select=&quot;ltype&quot; />
 <xsl:apply-templates select=&quot;ltype&quot;/>
 <xsl:value-of select=&quot;topos&quot; />
 <xsl:value-of select=&quot;toname&quot; />
</td>
</tr>
</xsl:for-each>
</table>

</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top