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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT Question

Status
Not open for further replies.

LOW

Programmer
Sep 27, 2000
45
0
0
US
I'm going to rephrase my earlier question and hopefully make it more clear.

Now, the value of target attribute is being returned in the results as “target=”_self”. The problem is that all records have that attribute value in the link. The records containing “sirepub” in DOCUMENT_URL should have a target value of “_blank”. I assume that the “when” part of the conditional choose test is not being understood and therefore defaulting to the value of “otherwise”.

So it seems my problem is with <xsl:when test="$meta=$document_url and contains(/@V, 'sirepub')">.

Here's the code:

<xsl:template name="drawcell">
<xsl:param name="meta"/>
<xsl:param name="linkfield"/>
<xsl:param name="document_url"/>
<td valign="top">
<xsl:if test="$linkfield=$meta">
<a>
<xsl:attribute name="href">
<xsl:value-of select="MT[@N='DOCUMENT_URL']/@V"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:choose>
<xsl:when test="$meta=$document_url and contains(/@V, 'sirepub')">
<xsl:value-of select="’_blank’" />
</xsl:when>
<xsl:eek:therwise>
<xsl:value-of select="’_self’"/>
</xsl:eek:therwise>
</xsl:choose>
</xsl:attribute>
</a>
</xsl:if>
</td>
</xsl:template>

Here's some sample xml.

<R N="6" MIME="application/pdf"> <U> <UE> <UD> <T>CITY OF SAN DIEGO COUNCIL DOCKET</T>
<RK>5</RK>
<CRAWLDATE>24 Jul 2008</CRAWLDATE>
<FS NAME="date" VALUE="2008-07-02" />
<MT N="DOC_DATE" V="2008-08-02" />
<MT N="DOCUMENT_URL" V=" />
<MT N="SORTORDER" V="1" />
<MT N="TITLE" V="Combined Monday Tuesday Docket" />
<S>Page 1. bla bla bla <b>...</b></S>
<LANG>en</LANG>
- <HAS>
<L />
<C SZ="" CID="1tDLa3mftjoJ" ENC="UTF-8" />
</HAS>
</R>
- <R N="7" MIME="application/pdf">
<U> <UE> <UD> <T>AGENDA FOR THE</T>
<RK>9</RK>
<CRAWLDATE>24 Jul 2008</CRAWLDATE>
<FS NAME="date" VALUE="2008-06-28" />
<MT N="DOC_DATE" V="2008-07-29" />
<MT N="DOCUMENT_URL" V=" />
<MT N="SORTORDER" V="1" />
<MT N="TITLE" V="Council Meeting Docket" />
<S>Page 1. AGENDA FOR THE REGULAR COUNCIL MEETING OF TUESDAY, JULY 29, 2008,<br> AT 10:00 AM CITY ADMINISTRATION BUILDING COUNCIL CHAMBERS <b>...</b></S>
<LANG>en</LANG>
- <HAS>
<L />
<C SZ="" CID="vka_CEfPf4IJ" ENC="UTF-8" />
</HAS>
</R>
 
In the named template, if ever MT[@N='DOCUMENT_URL']/@V makes sense for the href attribute, I would guess logically the R is the context node. In that case, per your description, it is this.
[tt]
<xsl:when test="$meta=$document_url and contains(MT[@N='DOCUMENT_URL']/@V, 'sirepub')">
<xsl:value-of select="'_blank'" />
</xsl:when>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top