xsl-list
[Top] [All Lists]

RE: system call?

2005-09-19 10:41:51
Pass the year you want to save as a parameter to your stylesheet. The method 
for doing this varies slightly by processor. In you stylesheet you declare a 
parameter like this:

<xsl:param name="savethis" />

Then you re-write you template like this:

 <xsl:if test="$year=$savethis">

-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     TGolshan(_at_)computer(_dot_)org
Sent:     Mon, 19 Sep 2005 10:30:51 -0700
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] system call?

I am trying to disable URL links from legacy files. I am not sure how to 
do this without hard-coding the $year to the current year, 2005. Any 
better ideas? I have heard that one might be able to do a system call, but 
that completely escaped me. 

Thanks in advance,
troy

**************************

XML file
<hdr2>
        <obi>
                <volno></volno>
                        <issno></issno>
        </obi>
        <pdt>
                <mo></mo>
                        <yr>2005</yr>
        </pdt>
        <pp</pp>
</hdr2>

<p><url>URL TEXT HERE</url></p>
 

Code
<xsl:variable name="year">
        <xsl:value-of select="article/fm/hdr/hdr2/pdt/yr"/>
</xsl:variable>

<xsl:template match="url">
                <xsl:if test="$year='2005'">
                        <a>
                                <xsl:choose>
                                        <xsl:when test="
substring(text(),1,5)='http:'">
                                                <xsl:attribute name="href
"><xsl:value-of select="text()"/></xsl:attribute>
                                        </xsl:when>
                                        <xsl:when test="
substring(text(),1,4)='ftp:'">
                                                <xsl:attribute name="href
"><xsl:value-of select="text()"/></xsl:attribute>
                                        </xsl:when>
                                        <xsl:otherwise>
                                                <xsl:attribute name="href
"><xsl:value-of select="concat('http://',text())"/></xsl:attribute>
                                        </xsl:otherwise>
                                </xsl:choose>
                                        <xsl:attribute name="target">blank
</xsl:attribute>
                                                <xsl:apply-templates/>
                        </a>
                </xsl:if> 
                <xsl:if test="$year!='2005'">
                        <xsl:apply-templates/>
                </xsl:if>
        </xsl:template>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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