English 中文(简体)
XSLT 页: 1
原标题:XSLT Match record length < 8
  • 时间:2012-05-10 12:39:16
  •  标签:
  • xslt

我设立了以下特别调查组,以确保所派遣的外地人口只有人数,但我不敢确定如何加以调整,以列入一份额外说明,确保它不再具有8个性质。

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="record[translate(employeeNumber,  0123456789 ,   )]"/>
</xsl:stylesheet>
最佳回答

你们是否希望忽略雇员人数超过8人的记录? 如果是的话,你就能够补充另一个模仿的模板,以忽视它们。

<xsl:template match="record[string-length(employeeNumber) > 8]"/>
问题回答

Here is a template you can use to truncate a string... hope this does the job!

<xsl:template name="fullortruncate">
    <xsl:param name="input" />
    <xsl:choose>
        <xsl:when test="string-length($input)>8">
            <xsl:value-of select="substring($input, 0, 8)"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$input"/>
        </xsl:otherwise>
    </xsl:choose> 
</xsl:template>

您可以使用“呼呼呼机”称呼模板。

<xsl:call-template name="fullortruncate">
<xsl:with-param name="input" select="[your input]"/>
</xsl:call-template>




相关问题
When test hanging in an infinite loop

I m tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here s the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> ...

quick xslt for-each question

Let s say I have an XML document that has this: <keywords> <keyword>test</keyword> <keyword>test2</keyword> <keyword>test3</keyword> <keyword>test4</...

XSLT Transform XML with Namespaces

I m trying to transform some XML into HTML using XSLT. Problem: I can t get it to work. Can someone tell me what I m doing wrong? XML: <ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/...

XSLT output to HTML

In my XSLT file, I have the following: <input type="button" value= <xsl:value-of select="name">> It s an error as it violates XML rule. What I actually want is having a value from an ...

Mangling IDs and References to IDs in XML

I m trying to compose xml elements into each other, and the problem I am having is when there s the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签