xsl-list
[Top] [All Lists]

RE: Outputting A tag information

2004-02-26 21:45:07
Hi Josh,
Thanks for responding. I tried that but I get this output:
aaa
aaa
  http://www.domain1.com/
Any clues?
Thanks for your help.
Vivek

-----Original Message-----
From: Josh Canfield [mailto:Josh(_dot_)Canfield(_at_)plumtree(_dot_)com] 
Sent: Thursday, February 26, 2004 10:34 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Outputting A tag information


Adding 
<xsl:apply-templates mode="proc-txt"/>

to your "p" template will apply-templates to the children of the p element, 
currently they are not getting applied.

<xsl:template match="p" mode="proc-txt">
<xsl:text> </xsl:text>&#160;
<xsl:value-of disable-output-escaping="yes" 
select="string(normalize-space(.))"/>&#160;
<xsl:apply-templates mode="proc-txt"/>
</xsl:template>

Josh

-----Original Message-----
From: Vivek Shinde [mailto:Vivek(_dot_)Shinde(_at_)sas(_dot_)com]
Sent: Thursday, February 26, 2004 5:32 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Outputting A tag information


Hello,

I have a XML document 

<p>aaaaa<a href="http://www.domain1.com/";>Text1</a>bbbbb<a 
href="http://www.domain2.com/";>Text2</a>ccccc</p>

I am trying to output this in Text format as:

aaaaa Text1
  http://www.domain1.com/
bbbbb Text2
  http://www.domain2.com/
ccccc

Here's the code I am using. I see text output for P tag but I do not see any 
results for 'a' tag. It looks like it does not match with 'a' tag.

<xsl:apply-templates select="document($xmlfile)" mode="proc-txt"/>

<xsl:template match="//p" mode="proc-txt">
<xsl:text> </xsl:text>&#160;
<xsl:value-of disable-output-escaping="yes" 
select="string(normalize-space(.))"/>&#160;
</xsl:template>


<xsl:template match="a" mode="proc-txt">
<xsl:variable name="oldurl" select="@href"/>
<xsl:choose>
<xsl:when test="contains($oldurl,'?')">
<xsl:text>  </xsl:text><xsl:value-of disable-output-escaping="yes" 
select="string(concat($oldurl, '&amp;', 'ETS=[[etsnum]]', '&amp;', 
'PID=[[profileid]]'))" />&#160; </xsl:when> <xsl:otherwise> <xsl:text>  
</xsl:text><xsl:value-of disable-output-escaping="yes" 
select="string(concat($oldurl, '?', 'ETS=[[etsnum]]', '&amp;', 
'PID=[[profileid]]'))" />&#160; </xsl:otherwise> </xsl:choose> </xsl:template>

Any help is greatly appreciated.
Thanks
Vivek


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>