I have an XML like this:
<V>
<W>
<X>1</X>
</W>
<W>
<Y>1</Y>
</W>
<W>
<X>1555</X>
</W>
<W>
<X>1</X>
</W>
</V>
I want to make it something like this:
<entity ID="start">
<f ID="NewField">0001</f>
<f ID="NewField">0001</f>
<f ID="NewField">0002</f>
<f ID="NewField">0003</f>
</entity>
When the field is V/W/X then NewField should be incremented by 1 as many times the tag V/W/X is found.
Similarly for V/W/Y.
The XSL which I am using is
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<entity ID="start">
<xsl:for-each select="V/W">
<xsl:if test="X">
<xsl:variable name="my_var">
<xsl:value-of select="concat('000',position())"/>
</xsl:variable>
<f ID="NewField"><xsl:value-of select="$my_var"/></f>
</xsl:if>
<xsl:if test="Y">
<xsl:variable name="my_var">
<xsl:value-of select="concat('000',position())"/>
</xsl:variable>
<f ID="NewField"><xsl:value-of select="$my_var"/></f>
</xsl:if>
</xsl:for-each>
</entity>
</xsl:template>
</xsl:stylesheet>
but it gives me a wrong result, something like this:
<entity ID="start">
<f ID="NewField">0001</f>
<f ID="NewField">0002</f>
<f ID="NewField">0003</f>
<f ID="NewField">0004</f>
</entity>
If you want to number nodes with XSLT then the xsl:number element can help:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<entity ID="start">
<xsl:apply-templates select="descendant::X | descendant::Y"/>
</entity>
</xsl:template>
<xsl:template match="X | Y">
<f ID="NewField"><xsl:number level="any" format="0000"/></f>
</xsl:template>
</xsl:stylesheet>
I think you're looking for something like count(preceding::X) expression. Of course you may want to make it more complex and then take care about number formatting, but that sounds like a starting point you're looking for.
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="V">
<entity ID="start">
<xsl:apply-templates select="W/X|W/Y" />
</entity>
</xsl:template>
<xsl:template match="X|Y">
<f ID="NewField">
<xsl:variable name="counter" select="
count(
parent::W/preceding-sibling::W/*[name() = name(current())]
) + 1
" />
<xsl:value-of select="format-number($counter, '0000')" />
</f>
</xsl:template>
</xsl:stylesheet>
This:
parent::W/preceding-sibling::W/*[name() = name(current())]
selects all preceding elements of the same name as the current element. E.g., if the point of execution is on this node:
<X>1555</X>
It goes one level up (parent::W), then selects all preceding <W> siblings, and of those it selects any child (*) that has a name of X - since X is the name of the current() element.
The resulting node-set is counted and incremented by one. format-number() is used to generate a nice clean output:
<entity ID="start">
<f ID="NewField">0001</f>
<f ID="NewField">0001</f>
<f ID="NewField">0002</f>
<f ID="NewField">0003</f>
</entity>
Related
I have elements with a certain number of child elements. The child elements look something like this:
<checker val="this" some="yuppi" here="there" what="nothing"/>
Some of these attributes act as a filter. I don't know which ones and how many in advance. I have to look that up in a different file that contains all the attributes used as a filter at that particular time. That file basically looks like this:
<someElem >
<f name="val" value="this"/>
<f name="other" value="that"/>
<f name="val" value="something"/>
</someElem>
<someElem >
<f name="val" value="this"/>
<f name="other" value="that"/>
<f name="some" value="yuppi"/>
</someElem>
So on a different occasion, with different source material, there may be more or less or different filter attributes.
I know which element in the look-up file to choose, because it has the same id as an element which is the parent element of the checker-elements. Basically, the parent elements of the checker-elements have a filter applied that filters out certain checker-elements.
What I ultimately want to achieve is this: I have an element which has lots of checker-elements as child elements and I only want to copy those checker elements into a new file that dont have any attributes listed in the look-up file, the filter file.
So in the example above, the checker element would not get copied into the new file because it has a val attribute and the corresponding element in the look-up file is the first one and it has an f-element whose name is val. That's enough for me to know that it should be disregared. The same would happen if the checker element had an attribute called other.
My current approach is something like this:
<xsl:for-each select="key('test', #id, $elemFile)">
<xsl:if test="#id = $curID">
<xsl:variable name="curElemID" select="#id"/>
<xsl:for-each select="node()"> <!-- these here are the checker-elements from the example. They are child nodes of another element that I am iterating over -->
<xsl:variable name="curElem" select="."/>
<xsl:for-each select="#*"> <!-- looking at each of the attributes of the checker-element -->
<xsl:choose>
<xsl:when test="$lookupfile//someElem[#id = $curElemID]//f/#name = local-name()"> <!-- check if the current checker-element has one of the attributes whose local-name is the same as the name-attribute value of the corresponding someElem element -->
<xsl:message>
<xsl:text>Hit </xsl:text><xsl:value-of select="$curElem/#id"/>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$curElem"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
Right now, the elements get copied into the new file even if they have one of the attributes.
Whats the best way to code this?
I hope I was able to explain my problem...
Thanks in advance for tips and help!
EDIT
A hopefully clearer example.
The file with the checker elements:
<root>
<abc id="someId">
<checker val="this" test="testest" here="there" what="nothing"/>
<checker some="yuppi" here="there" />
<checker other="that"/>
</abc>
<abc id="someOtherId">
<checker val="this" some="yuppi" here="there" what="nothing"/>
<checker some="yuppi" here="there" what="nothing"/>
<checker attr="val""/>
</abc>
</root>
the look-up file:
<someElem id="someId"> <!-- filter that gets applied to the first abc element-->
<f name="val" value="this"/>
<f name="other" value="that"/>
<f name="val" value="something"/>
</someElem>
<someElem id="someOtherId"> <!-- filter that gets applied to the second abc element-->
<f name="other" value="that"/>
<f name="some" value="yuppi"/>
</someElem>
Expected output:
<new>
<abc id="someId">
<checker some="yuppi" here="there" />
</abc>
<abc id="someOtherId">
<checker attr="val""/>
</abc>
</new>
in the first abc element, the first checker element gets filtered out because in the someElem that has the same id as the abc element, the filters specified are val and other - the first checker element has an attribute called val.
The third checker element gets filtered out because it has an attribute called other
in the second abc element, the first two checker elements get filtered out because of the same rule. They have at least one attribute that is specified as a filter.
I believe you could use something like this:
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="lookupdoc" select="'path/to/your/other/file.xml'" />
<xsl:key name="f" match="f" use="../#id" />
<!-- identity transform -->
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root">
<new>
<xsl:apply-templates select="#*|node()"/>
</new>
</xsl:template>
<xsl:template match="abc">
<xsl:variable name="x-names" select="key('f', #id, document($lookupdoc))/#name" />
<xsl:copy>
<xsl:copy-of select="#*"/>
<xsl:apply-templates select="checker[not(#*[name()=$x-names])]"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Note: both your files must be well-formed for this to work; currently neither of them is.
I have an xml like this one:
<?xml version="1.0" encoding="WINDOWS-1252" ?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<root>
<something>
<cd>a1</cd>
<cd>a2</cd>
</something>
<another>
<cd>b1</cd>
<cd>b2</cd>
<cd>b3</cd>
<cd>b1</cd>
<cd>b2</cd>
<cd>b3</cd>
<cd>b1</cd>
<cd>b2</cd>
</another>
</root>
I'm selecting all the cd nodes and trying to take the cds from 10 to 10 (1st, 11th, 21th...) this way:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html><body>
<xsl:apply-templates select="//cd" />
</body></html>
</xsl:template>
<xsl:template match="cd"/>
<xsl:template match="cd[position() mod 10 = 1]">
<div>
pos:<xsl:value-of select="position()"/>;
value:<xsl:value-of select="."/>
</div>
</xsl:template>
</xsl:stylesheet>
The output:
pos:1; value:a1
pos:3; value:b3
And the expected output:
pos:1; value:a1
pos:11; value:b11
The problem is that position() in the match is the node number based on his parent. So the position() of "b1" is 1 and not 3. Is there a function to know the index of the current node?
Thanks in advance.
//EDIT to extend the example
You can get a more accurate count by using xsl:number:
<xsl:template match="cd">
<div>pos: <xsl:number level="any"/></div>
</xsl:template>
You could also count the preceding cd elements:
<xsl:template match="cd">
<div>pos: <xsl:value-of select="count(preceding::cd)+1"/></div>
</xsl:template>
I prefer xsl:number, but I suppose it depends on how you're using the value. If you give a better example of what you're trying to do with that number, I can update my answer.
Example based on question update:
Input
<root>
<something>
<cd>a1</cd>
<cd>a2</cd>
</something>
<another>
<cd>b1</cd>
<cd>b2</cd>
<cd>b3</cd>
<cd>b1</cd>
<cd>b2</cd>
<cd>b3</cd>
<cd>b1</cd>
<cd>b2</cd>
</another>
<another>
<cd>c1</cd>
<cd>c2</cd>
<cd>c3</cd>
<cd>c1</cd>
<cd>c2</cd>
<cd>c3</cd>
<cd>c1</cd>
<cd>c2</cd>
</another>
</root>
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html><body>
<xsl:apply-templates select="//cd" />
</body></html>
</xsl:template>
<xsl:template match="cd"/>
<xsl:template match="cd[(count(preceding::cd)+1) mod 10 = 1]">
<div>
pos:<xsl:value-of select="position()"/>;
value:<xsl:value-of select="."/>
</div>
</xsl:template>
</xsl:stylesheet>
Output
<html>
<body>
<div>
pos:1;
value:a1
</div>
<div>
pos:11;
value:c1
</div>
</body>
</html>
The position() in the match of template filters "cd"s based on position in its parent:
<xsl:template match="cd[position() mod (10) = 1]">
and the position() inside the template definition,
<div>pos:<xsl:value-of select="position()"/></div>
gives you the cd's sequence which the template has been applied for.
Thus, "position() mod (10) = 1" filters only those "cd"s which are 1st, 11th, 21st, etc. children of their parents.
Hence, you can remove the filter from xsl:template's match and put it inside like this:
<xsl:template match="cd">
<div>pos:<xsl:if test="position() mod 10 = 1">
<xsl:value-of select="position()"/>
</xsl:if>
</div>
</xsl:template>
This will save all the CDs in a variable. In the for-each, the context does not depend on the parent nodes so you will get the position among all CDs:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="all-cds" select="//cd" />
<xsl:template match="root">
<xsl:for-each select="$all-cds">
<div>pos: <xsl:value-of select="position()"/></div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
In an input XML file, along with Static Columns, columns expecting data from other files (reference)is also available.
But for each reference, the input xml has separate row with same ID or UID.
The output file has to have all references and relations in one row (based on the ID or UID)
I wrote the XSLT for this transformation also. This XSLT is faster when the row count is less (< 100 or < 200). But, as the count grows, the output xml generation taking long time (for count of 1000 rows, around 30 mins).
I am using
<xsl:for-each select="z:row/#ID[generate-id() = generate-id(key('UniqueID',.))]">
in the XSLT. Because for the same ID in each row of input xml, it has to check for multiple references (like section) and relations (like Child) and populate the same as columns
Input Raw XML File.
<xml xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:z="#RowsetSchema">
<rs:data>
<z:row UID="PARENT_001_1221AD_A878" GroupID="" GroupRel="" ID="37" Name="Outer Asset Details" RelProduct="Line1" RelUID="CHILD1_101_9899_9POOU99" RelName="CHILD1" RelType="Child" Size="22"/>
<z:row UID="PARENT_001_1221AD_A878" GroupID="" GroupRel="" ID="37" Name="Outer Asset Details" RelProduct="Line1" RelUID="CHILD2_201_5646546_9890PBS" RelName="CHILD1" RelType="Child" Size="22"/>
<z:row UID="PARENT_001_1221AD_A878" GroupID="" GroupRel="" ID="37" Name="Outer Asset Details" RelProduct="Line1" RelUID="SEC_999_99565_998AFSD" RelName="Hydraulic Section" RelType="Section" Size="22"/>
</rs:data>
Child.xml
<Child xsi:noNamespaceSchemaLocation="../XSD/Child.xsd" FILE="Child" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Row UID="CHILD1_101_9899_9POOU99">
<Name>CHILD1</Name>
<Description>This has details about the Hydraulic sections of the automobile</Description>
</Row>
<Row UID="CHILD2_201_5646546_9890PBS">
<Name>CHILD2</Name>
<Description>This has details about the manual sections of the automobile</Description>
</Row>
Section.xml
<Section xsi:noNamespaceSchemaLocation="../XSD/Section.xsd" FILE="Section" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Row UID="SEC_999_99565_998AFSD">
<Name>Hydraulic Section</Name>
<Description>This has details about the Sections in which the Hydraulic Systems are used.</Description>
</Row>
XSLT File
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" exclude-result-prefixes="s dt z rs msxsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:key name="UniqueID" match="z:row/#ID" use="."/>
<xsl:template match="/">
<Parent xsi:noNamespaceSchemaLocation="../XSD/Parent.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" FILE="Parent">
<xsl:for-each select="xml">
<xsl:apply-templates select="rs:data"/>
</xsl:for-each>
</Parent>
</xsl:template>
<xsl:template match="rs:data">
<xsl:for-each select="z:row/#ID[generate-id() = generate-id(key('UniqueID',.))]">
<xsl:variable name="FRId">
<xsl:value-of select="current()"/>
</xsl:variable>
<xsl:variable name="curNSet" select="//z:row[#ID=$FRId]"/>
<xsl:copy-of select="current()"/>
<Record>
<xsl:attribute name="UID"><xsl:value-of select="$curNSet/#UID"/></xsl:attribute>
<xsl:element name="Size">
<xsl:value-of select="$curNSet/#Size"/>
</xsl:element>
<xsl:element name="Child">
<xsl:apply-templates select="$curNSet[#RelType='Child']" mode="Relations">
<xsl:with-param name="RelType" select="'Child'"/>
<xsl:with-param name="DstFileName" select="'../Files/Child.xml'"/>
</xsl:apply-templates>
</xsl:element>
<xsl:element name="Section">
<xsl:apply-templates select="$curNSet[#RelType='Section']" mode="References">
<xsl:with-param name="RelType" select="'Section'"/>
<xsl:with-param name="DstFileName" select="'../Files/Section.xml'"/>
</xsl:apply-templates>
</xsl:element>
</Record>
</xsl:for-each>
</xsl:template>
<xsl:template match="z:row" mode="Relations">
<xsl:param name="RelType"/>
<xsl:param name="DstFileName"/>
<xsl:element name="{$RelType}">
<xsl:attribute name="DestinationKey"><xsl:value-of select="#RelUID"/></xsl:attribute>
<xsl:attribute name="RelFilePath"><xsl:value-of select="$DstFileName"/></xsl:attribute>
<xsl:attribute name="SequenceNumber"><xsl:value-of select="position()"/></xsl:attribute>
<xsl:value-of select="#RelName"/>
</xsl:element>
</xsl:template>
<xsl:template match="z:row" mode="References">
<xsl:param name="DstFileName"/>
<xsl:attribute name="DestinationKey"><xsl:value-of select="#RelUID"/></xsl:attribute>
<xsl:attribute name="RelFilePath"><xsl:value-of select="$DstFileName"/></xsl:attribute>
<xsl:attribute name="SequenceNumber"><xsl:value-of select="position()"/></xsl:attribute>
<xsl:value-of select="#RelName"/>
</xsl:template>
Output.xml
<Parent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../XSD/Parent.xsd" FILE="Parent" ID="37">
<Record UID="PARENT_001_1221AD_A878">
<Size>22</Size>
<Child>
<Child DestinationKey="CHILD1_101_9899_9POOU99" RelFilePath="../Files/Child.xml" SequenceNumber="1">CHILD1</Child>
<Child DestinationKey="CHILD2_201_5646546_9890PBS" RelFilePath="../Files/Child.xml" SequenceNumber="2">CHILD1</Child>
</Child>
<Section DestinationKey="SEC_999_99565_998AFSD" RelFilePath="../Files/Section.xml" SequenceNumber="1">Hydraulic Section</Section>
</Record>
Please help me in optimizing the XSLT, so that the output file is generated faster
Consider to use
<xsl:key name="UniqueID" match="z:row" use="#ID"/>
then
<xsl:for-each select="z:row/#ID[generate-id() = generate-id(key('UniqueID',.))]">
<xsl:variable name="FRId">
<xsl:value-of select="current()"/>
</xsl:variable>
<xsl:variable name="curNSet" select="//z:row[#ID=$FRId]"/>
can be replaced with
<xsl:for-each select="z:row[generate-id() = generate-id(key('UniqueID', #ID))]">
<xsl:variable name="FRId" select="#ID"/>
<xsl:variable name="curNSet" select="key('UniqueID', #ID"/>
I am not sure you need the variable FRId at all but defining it with a select attribute instead of a nested value-of is certainly consuming less resources.
To make
<xsl:apply-templates select="$curNSet[#RelType='Child']" mode="Relations">
more efficient define a key
<xsl:key name="rel" match="z:row" use="concat(#ID, '|', #RelType)"/>
then use
<xsl:apply-templates select="key('rel', concat(#ID, '|', 'Child')" mode="Relations">
Then use the same approach for the other apply-templates.
All of the above is untested but should give you an idea.
I am trying to get the last value of a node that belongs to a group.
Given the following XML -
<books>
<author>
<name>R.R.</name>
<titles>
<titlename>North</titlename>
<titlename>King</titilename>
</titles>
</author>
<author>
<name>R.L.</name>
<titles>
<titlename>Dragon</titlename>
<titlename>Wild</titilename>
</titles>
</author>
</books>
I assume it would be something like -
<template match="/">
<for-each-group select="books/author" group-by="name">
<lastTitle>
<name><xsl:value-of select="name"/></name>
<title><xsl:value-of select="last()/name"/></title>
</lastTitle
</for-each-group>
<template>
Thus the result would be -
<lastTitle>
<name>R.R</name>
<title>King</title>
</lastTitle>
<lastTitle>
<name>R.L.</name>
<title>Wild</title>
</lastTitle>
How can I produce this result?
Instead of doing this
<xsl:value-of select="last()/name"/>
The expression you are looking for is this:
<xsl:value-of select="titles/titlename[last()]"/>
However, it might be worth pointing out, this isn't really a 'grouping' problem. (It would only be a grouping problems if you have two different author elements with the same name). You can actually just use a simple xsl:for-each here
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="books/author">
<lastTitle>
<name>
<xsl:value-of select="name"/>
</name>
<title>
<xsl:value-of select="titles/titlename[last()]"/>
</title>
</lastTitle>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I have a XML Document like this:
<Module Name="DacInPlaceUpgradeLtmTest" Desc="" >
<TestCase Name="ExecuteInPlaceUpgradeTest">
<TestCase Name="BugRepro">
<TestCase Name="295130">
<Variation Id="1" Desc="Sql - EmptyAlterScript">
<Variation Id="2" Desc="Sql - EmptyDatabase">
</TestCase>
</TestCase>
</TestCase>
</Module>
I use xsl to get a value:
ExectionInplaceUPgradeTest BugRepro 295130
by using following template:
<xsl:template match="TestCase//Variation">
<xsl:for-each select="..#Name">
Today, I can only get 295130, I wonder how can I get all Attribtes of the parent nodes which is TestCase.
I wonder how can I get all Attributes of the parent nodes which is TestCase
You might need the XPath ancestor-or-self axis:
ancestor-or-self::TestCase/#Name
how to concat the attribte names of the parent nodes
It really depends on the template context and on the code you are already working on. taking as a reference your fragment, I would write better:
<xsl:template match="TestCase[Variation]">
<xsl:for-each select="ancestor-or-self::TestCase/#Name">
<xsl:value-of select="concat(.,' ')"/>
</xsl:for-each>
</xsl:template>
This will print the wanted string starting from the TestCase node which has a Variation node as a child.
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="Variation[#Id = 1]">
<xsl:apply-templates mode="printName"
select="ancestor::TestCase"/>
</xsl:template>
<xsl:template match="TestCase" mode="printName">
<xsl:if test="not(position()=1)">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="#Name"/>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
when applied on the provided XML document:
<Module Name="DacInPlaceUpgradeLtmTest" Desc="" >
<TestCase Name="ExecuteInPlaceUpgradeTest">
<TestCase Name="BugRepro">
<TestCase Name="295130">
<Variation Id="1" Desc="Sql - EmptyAlterScript"/>
<Variation Id="2" Desc="Sql - EmptyDatabase"/>
</TestCase>
</TestCase>
</TestCase>
</Module>
produces the wanted, correct result:
ExecuteInPlaceUpgradeTest BugRepro 295130
II. XPath 2.0/XSLT 2.0 solution
//TestCase[Variation]
/ancestor-or-self::TestCase
/#Name/string(.)
The above XPath 2.0 expression when evaluated on the above XML document produces exactly the wanted, correct result:
ExecuteInPlaceUpgradeTest BugRepro 295130
It can be used in the following XSLT 2.0 solution:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:sequence select=
"//TestCase[Variation]
/ancestor-or-self::TestCase
/#Name/string(.)
"/>
</xsl:template>
</xsl:stylesheet>