Passo a passo: usando XSLT IntelliSense
Essa explicação passo a passo demonstra como usar IntelliSense do XSLT para completar automaticamente o valor de alguns atributos.
Para usar o IntelliSense no atributo de nome de elementos xsl:with-param e xsl:call-template
Crie um novo arquivo XSLT e copie no seguinte código:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <!-- These 2 elements effectively assign $messages = resources/en.xml/<messages>, then $messages is used in the "localized-message" template. --> <xsl:param name="lang">en</xsl:param> <xsl:variable name="messages" select="document(concat('resources/', $lang, '.xml'))/messages"/> <xsl:template name="msg23" match="msg23"> </xsl:template> <xsl:template name="localized-message"> <xsl:param name="msgcode"/> <!-- Show message string. --> <xsl:message terminate="yes"> <xsl:value-of select="$messages/message[@name=$msgcode]"/> </xsl:message> </xsl:template> </xsl:stylesheet>
Insira o cursor após
<xsl:template name="msg23" match="msg23">
e pressione Enter. Inicie digitando o elementoxsl:call-template
a seguir:<xsl:call-template name="localized-message"> </xsl:call-template>
A lista de nomes de modelo aparece no atributo
name=""
do elementoxsl:call-template
à medida que você digita.Insira o cursor após
<xsl:call-template name="localized-message">
e pressione Enter. Inicie digitando o elementoxsl:with-param
a seguir:<xsl:with-param name="msgcode">msg23</xsl:with-param>
A lista de nomes de parâmetro aparece no atributo
name=""
do elementoxsl:with-param
.
Para usar o IntelliSense no atributo do modo de um elemento xsl:apply-templates
Crie um novo arquivo XSLT e copie no seguinte código:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <HTML> <BODY> <TABLE> <xsl:apply-templates select="customers/customer"> <xsl:sort select="state"/> <xsl:sort select="name"/> </xsl:apply-templates> </TABLE> </BODY> </HTML> </xsl:template> <xsl:template match="customer"> <TR> <xsl:apply-templates select="name" /> <xsl:apply-templates select="address" /> <xsl:apply-templates select="phone" /> </TR> </xsl:template> <xsl:template match="name"> <TD STYLE="font-size:14pt font-family:serif"> <xsl:apply-templates /> </TD> </xsl:template> <xsl:template match="address"> <TD> <xsl:apply-templates /> </TD> </xsl:template> <xsl:template match="phone"> <TD> <xsl:apply-templates /> </TD> </xsl:template> <xsl:template match="phone" mode="accountNumber"> <xsl:param name="Area_Code"/> <TD STYLE="font-style:italic"> 1-<xsl:value-of select="."/>-001 </TD> </xsl:template> </xsl:stylesheet>
Insira o cursor após
<xsl:apply-templates select="phone" />
e pressione Enter. Inicie digitando o elementoxsl: apply-templates
a seguir:<xsl:apply-templates select="phone" mode="accountNumber">
A lista de modos de modelo aparece no atributo
mode=""
do elementoxsl:apply-templates
.
Para usar o IntelliSense nos atributos stylesheet-prefix e result-prefix de um elemento xsl:namespace-alias
Crie um novo arquivo XSLT e copie no seguinte código:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:alt="http://www.w3.org/1999/XSL/Transform-alternate" version="1.0"> <xsl:param name="browser" select="'InternetExplorer'"/> <xsl:template match="/"> <alt:stylesheet> <xsl:choose> <xsl:when test="$browser='InternetExplorer'"> <alt:import href="IERoutines.xsl"/> <alt:template match="/"> <div> <alt:call-template name="showTable"/> </div> </alt:template> </xsl:when> <xsl:otherwise> <alt:import href="OtherBrowserRoutines.xsl"/> <alt:template match="/"> <div> <alt:call-template name="showTable"/> </div> </alt:template> </xsl:otherwise> </xsl:choose> </alt:stylesheet> </xsl:template> </xsl:stylesheet>
Insira o cursor após
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:alt="http://www.w3.org/1999/XSL/Transform-alternate" version="1.0">
e pressione Enter. Inicie digitando o elementoxsl:namespace-alias
a seguir:<xsl:namespace-alias stylesheet-prefix="alt" result-prefix="xsl"/>
Observe como a lista de prefixos apareceu nos atributos
stylesheet-prefix
eresult-prefix
do elemento dexsl:namespace-alias
.