Web Programming 4 and 5 TH Unit
Web Programming 4 and 5 TH Unit
INTRODUCTION TO XML
XML or eXtensible Markup Language is a text based markup language that
enables you to store data in a structured format.
XML is a cross platform and both hardware and software independent
markup language
It can be used to transfer structured data between heterogeneous systems.
It also used as data interchange format in a number of applications. Wireless
markup language is used for web applications.
LIMITATIONS OF EDI
EDI standard have various limitations. these includes:
Rigid transaction set
Fixed business rules
High costs
Slow pace of standards evolution
HIGH COSTS
Implementing EDI standard, can be expensive for small and medium sized
business units.
When compared to large business units because VAN’ s are costly.
ADVANTAGES OF XML
some of the advantages offered by XML are as follows:
1. provides a way of creating domain specific vocabulary
2. allows data interchange between different computers
3. enables smart searchers
4. provides user selected view of data
5. allows granular updates
DATA INTERCHANGE
Data interchange is essential to carry out business transactions.
XML allows you to store data in structured text format.
XML provides files that are unambiguous and easy to generate and read.
SMART SEARCHERS
Although HTML provides you a set of predefined tags, implementing a search
on a HTML document is a difficult task.
The best picture award in 1999 went to the film<B>titanic.
</B>
This film was based on the story of a ship called <B>titanic.
</B>
On the other hand , the flexibility to create user defined provided by XML:
The best picture award in 1999 went to the film
<FILM>titanic</FILM>
This film was based on the story of a ship called
<SHIP>titanic</SHIP>
GRANULAR UPDATES
If you want to fetch the updated information from the server, the entire page
needs to be refreshed.
The entire page need not be refreshed.
Only the changed content needs to be downloaded.
ROLE OF W3C IN DEFINING XML-RELEATED SPECIFICATIONS
XML was defined by W3C to ensure that structured data is uniform and
independent of vendors or application.
Some of the rules are listed below:
1. XML must be directly usable over the internet.
2. XML must support a wide variety of applications.
3. XML must be compatible with SGML.
4. XML documents must be human-legible and clear.
5. XML design must be formal and concise.
ELEMENTS
Elements are basic units that are used to identify and describe data in XML.
They are the building blocks of an XML document.
Elements are represented using tags.
<Authorname>john smith</Authorname>
XML allow you to provide meaningful names to elements.
In preceding example, the Authorname element is used to store the names of
authors.
An XML document must always have a root element. A root element
contains all other elements in the document.
<?xml version =”1.0”>
<AUTHORS>
<AUTHOR>
<FIRSTNAME> John</FIRSTNAME>
<LASTNAME>Smith</LASTNAME>
</AUTHOR>
</AUTHORS>
The AUTHOR element contains all other elements in the XML document and
is, therefore, called the root element.
CONTENT
The information that is represented by the elements of an XML document is
referred to as the content of that element.
<BOOKNAME>The painted house</BOOKNAME>
XML enables you to declare and use elements that can contain different kinds
of information.
An element can contain any of the following types of content:
1. character or data content
2. element content
3. combination or mixed content
Character or Data Content
Elements that contain only textual information are said to have character or
data content.
<BOOKNAME>The painted house</BOOKNAME>
In this example , the BOOKNAME element contains only textual information.
Element Content
Elements can contain other elements.
The elements contained within another element are called child elements.
The containing element is called the parent element.
A parent can contain many child elements.
<AUTHOR>
<FNAME> JOHN </FNAME>
<LNAME> SMITH> </LNAME>
</AUTHOR>
Combination or Mixed Content
Elements can contain textual information as well as other elements.
<PRODUCT DESCRIBTION>
The product is available in two colors.
<COLOR> RED </COLOR>
<COLOR> BLUE </COLOR>
</PRODUCT DESCRIBTION>
ATTRIBUTES
Elements can have one or more attributes. Attributes provide additional
information about elements.
Attributes can be either mandatory or optional.
An attribute consists of a name value pair.
<PRODUCTNAME PRODID = “P001”>Barbie doll</PRODUCTNAME>
You may decide to present information either using elements or attributes.
There are no rules governing this decision.
1. If data must be displayed, you can represent it as an element.
2. If data must be updated frequently, it is better represented as an
element because it is easier to edit elements than attributes with xml
editing tool.
3. If the value of piece of information must be checked frequently, it may
be represented as an attribute.
ENTITIES
An entity can be described as a shortcut to a set of information.
It is a name that is associated with in a block of data.
When an entity is used in XML file, it expands to its full definition.
<COMMENT> this article appeared in &nyt ; on Dec 12, 2000 </COMMENT>
When you open the document containing the preceding code in a browser, it
displays the text “This article appeared in New York Times on Dec 12, 2000”.
The entity nyt acts as a short name for “New York Times”.
XML supports the use of three kinds of entities: internal, general and
parameter entities.
Internal Entities
Some characters cannot be used in XML documents because they have a
special meaning.
Ex: < is used as a delimiter for tags.
XML provides some predefined entities to enable you to express such
characters in an XML document.
These predefined entities are called internal entities.
It consists of a name that is associated with a block of information.
This can be easily identified as it is always preceded by an ampersand (&)
symbol and terminated with a semicolon.
&It; - used to display the less than (<) symbol.
> - used to display the greater than (>) symbol.
& - used to display the ampersand (&) symbol.
" - used to display the double quote(“) character.
COMMENTS
Comments are statements used to provide documentation information about
an application comments are essential.
It is a good programming practice to include comments along with the code.
XML comments are created by using an opening angular brackets by an
exclamation mark and two hyphens (<!__) and closing angular brackets
followed by two hyphens(__>).
<!__PRODUCTDATA is the root element-> // valid
</-PRODUCTDATA is the – root element__> //invalid
STRUCTURE OF AN XML
In order to make an application more flexible, you need to work with various
options, such as the appearance or the structure of a document.
Both HTML and XML are used to publish documents on the Web through they
serve different purposes.
HTML has a fixed set of elements.
XML does not define any elements but allows you to define the structure per
your requirements.
XML allows you to store data in a meaningful structure.
If two trading partners have to interchange data the structure in which they
store the data should be consistent.
To represent data in a consistent format, it needs to be given a meaningful
structure.
To represent data in a uniform manner, you define the structure of an XML
document.
The following XML related specifications to define the structure of an XML
document:
1. document type definition(DTD)
2. XML schema definition(XSD)
DECLARING ATTRIBUTES
TYPES OF DTD’ s
A DTD can be part of an XML document or can be a separate file containing
declarations of elements and attributes.
DTD can be classified into two types, internal and external DTD’ s.
Difference between Internal and External DTDs
INTENAL DTD EXTERNAL DTD
A part of an XML document. It is maintained as a separate file. A
reference to this file is included in an
XML document.
Can be used only by the document in It can be used across multiple
which it is created and cannot be documents.
used across multiple documents.
The use of the < ! DOCTTTYPE> declaration in the XML document, used to
associate the external DTD products.dtd with the XML document.
XML Schema
An XML Schema is used to define the structure of an XML document.
Microsoft has developed a language that is used to define the schema of an XML
document.
This language is called the XML Schema Definition (XSD) language.
XML schemas have now become a W3C recommendation for creating valid XML
documents.
Advantages of XML Schemas over DTDs
An XML schema created using XSD is similar to a DTD.
An XML schema created by using XSD has many advantages over DTD.
Some of the advantages are:
1. XSD provides more control over the type of data that can be assigned to
elements and attributes as compared to DTD.
2. DTD does not enable you to define your own customized data types. XSD
enable you to create your own data types.
3. XSD also allows you to specify restrictions on data.
4. The syntax for defining a DTD is different from the syntax used for
creating an XML document. The syntax for defining an XSD is the same as
the syntax of an XML document.
Data Types Used in an XML Schema
A data type specifies the type of content that an element can hold.
XSD provides a list of predefined data types.
These data types can be classified as:
1. Primitive
2. Derived
3. Atomic
4. List
5. Union
Primitive Data Types
Primitive data types are the fundamental data types.
These data types are the basis for defining other data types.
Primitive data types do not contain elements or attributes.
They contain only values.
Primitive Description
String Represents a collection of characters
Represents decimal numbers. This can
Decimal
be used to define a value accurately
Represents single-precision 32-bit
Float
floating-point numbers
Represents Boolean values. This data
Boolean
type can have true or false as its value.
TimeDuration Represents a duration of time
Represents an activity that recurs after
RecurringDuration
a specific time duration
Derived Data Types
Derived data types are defined using other data types called base types.
Base data types be either primitive or derived data types.
Derived data types can be built-in or user-defined.
Derived Data Type Base Data Type Description
Integer Decimal Represents a sequence of
decimal digits with an
optional leading sign
Long Integer Represents a value within
the range of
9223372036854775808and
9223372036854775807
nonNegativeInteger Integer Represents an integer that
is greater than or equal to
zero
PositiveInteger NonNegativeInteger Represents an integer
greater than zero
Int Long Represents an integer that
can have a minimum value
of 2147483648 and a
minimum value of
2147483647
Time RecurringDuration Represents an instance of
time that recurs everyday
Date TimeDuration Represents a time period
that starts at the midnight
of a particular day and ends
the next midnight
Atomic Data Types
Atomic data types are those data types that cannot be broken down into smaller
units.
These data types can be primitive or derived.
String is a primitive data type that cannot be broken down further into small
units.
List Data Types
List data types are derived data types that contain a set of values of an atomic
data type.
For example, you can create a list data type called ‘pointlist’ derived from the
data type decimal, which can contain the values 0.5, 0.25, and 0.75.
Any element that is associated with the data type, pontlist can contain only 0.5,
0.25, and 0.75 as its value.
Union Data Types
Union data types are derived from atomic and list data types.
For example, ‘zipnum’ is a list data type that contain a combination of both.
<ZIPCODE> NY </ZIPCODE>
<ZIPCODE> 90547 96098 90878 </ZIPCODE>
<ZIPCODE> CA <ZIPCODE>
In addition to the predefined data types, XSD also allows you to define custom
data types.
The custom data types can be classified as:
1. Simple Data Type: A data type that contains only values.
2. Complex Data Types: A data type that contains child elements, attributes,
and mixed content.
Declaring a Simple Type Element
A simple type element does not contain any child elements or attributes.
It contains only values such as numbers, strings and dates.
Syntax:
<xsd: element name = “element-name” type = “data type” min occurs =
“nonNegativeInteger” maxoccurs = “nonNegativeInteger|unbounded”/>
Attributes of an Element
Attributes Description
Name Specifies the name of the element being
declared.
Type Specifies the data type of the element
being declared.
MinOccurs Specifies the minimum number of times
an element can occur. If you specify
minOccurs as zero, it means that the
element is optional. If you set it to a
value greater than zero, it means that
the element is mandatory and must
occur at least the specified number of
times.
MaxOccurs Specifies the maximum number of times
an element can appear, if you specify
maxOccurs as unbounded, it means that
the element can appear any number of
times in an XML document.
<PRODUCTDATA>
<PRODUCT PRODUCTID = “P001” CATEGORY = “BOOKS”>
<PRODUCTNAME> Gone with the Wind </PRODUCTNAME>
<DESCRIPTION> The backdrop of this book is the American Civil War
</DESCRIPTION>
<PRICE> 25.00 </PRICE>
<QUANTITY> 35 </QUANTITY>
</PRODUCT>
</PRODUCTDATA>
You can create Simple data types to the above code as follows:
<xsd:element name = “PRODUCTNAME” type = “xsd:string”/>
<xsd:element name = “DESCRIPTION” type = “xsd:string”/>
<xsd:element name = “PRICE” type = “xsd:positiveInteger”/>
<xsd:element name = “QUANTITY” type = “xsd:nonNegativeInteger”/>
To associate an element with a user-defined simple type, you must define the
new simple type.
<EMPNAME> JOHN SMITH </EMPNAME>
<EMPADDRESS> 10, LIONS STREET, BOSTON </EMPNAME>
<EMPPHONE> 172-693-2248 </EMPPHONE>
You can specify various facet values on elements by creating a new simple type
based on an existing data type.
Facets are the various attributes of a simple type that determine the values for a
simple type.
Consider the following code:
<xsd : simpletype name = “phoneno”>
<xsd : restriction base = “xsd : string”>
<xsd : length value = “10”/>
<xsd : pattern value = “\d{3} - \ d{3} - \ d{4}”/>
</xsd : restriction> </xsd : simpletype>
Facets of a String Data Type
Data Type Description
Length Specifies the number of characters the
data type can contain, value must be a
nonNegativeInteger.
MinLength Specifies the minimum length of the
values that the data type must contain,
value must be nonNegativeInteger.
MaxLength Specifies the maximum length of the
values that the data type must contain,
value must be nonNegativeInteger.
Pattern Specifies the regular expression that the
data type’s values must match.
Enumeration Specifies the set of values that the data
type can contain
Creating a Complex Type Element
A complex type element is one of that contains other elements, attributes, and
mixed content.
To declare a complex type element, you need to first define a complex type.
You can then declare a complex element by associating the complex type with
the element.
You can define a complex type by using the syntax :
<xsd : complex Type name = “data type name”>
Content model declaration
</xsd : complexType>
in the cybershopper scenario, the element PRODUCT is a complex element.
To declare the element PRODUCT, you need to first create a complex data type,
as belown:
<xsd : ComplexType name = “prdt”>
<xsd : sequence>
<xsd : element name = “PRODUCTNAME” type = “xsd : string”/>
<xsd : element name = “DESCRIPTION” type = “xsd : string”/>
<xsd : element name = “PRICE” type = “xsd : positiveInteger”/>
<xsd : element name = “QUANTITY” type = “xsd : nonNegativeInteger”/>
</xsd : sequence>
</xsd : complexType>
The data type is referenced by a name, it is called a named data type.
A named data type is one in which a set of elements and attributes are
referenced by a single name.
At the time of declaring an element, this data type is referenced by the type
identifier.
Named data types can be identified by the type identifier in the element
declaration statement.
Named data types can be then be reused in any part of a schema.
Data types that are not referenced by a common name are called anonymous
data type.
These data types can be identified by the absence of the type identifier in the
element declaration statement.
Anonymous data types can be referenced only once in a schema.
<xsd : element name = “PRODUCT”/>
<xsd : complexType> <xsd : sequence>
<xsd : element name = “PRODUCTNAME” type = “xsd : string”/>
<xsd : element name = “DESCRIPTION” type = “xsd : string”/>
<xsd : element name = “PRICE” type = “xsd : positiveInteger”/>
<xsd : element name = “QUANTITY” type = “xsd : nonNegativeInteger”/>
</xsd : sequence>
</xsd : complexType>
Creating an XML Document
An XML file cannot be directly associated with an XML schema file.
An XML file can be associated with an XML schema only through a validator.
Consider a scenario to understand how an XML document can be created and
validated against a DTD.
The head office of CyberShoppe sends information about its products to its
various branch offices.
The product details must be stored in a consistent format at all the branches.
Certain restrictions must be placed on the kind of data that can be saved in the
data store to ensure the uniformity and consistency of information.
Elements Used in XSD
ELEMENTS DESCRIPTION
Indicates that data about products is being
PRODUCTDATA stored in XML document; act as the root
element for all other elements
Represents the details (product name,
PRODUCT description, price, and quantity) for each
product
PRODUCTNAME Represents the name of the each product
Represents the description of each
DESCRIPTION
product
PRICE Represents the price of each product
QUANTITY Represents the quantity of each product
UNIT - V
Declaring Attributes
While creating an XML schema, you define a set of elements in the schema to
provide a structure to the XML document.
Defining elements only might not help you to structure the XML document in
a desired format to achieve result, you might want to further qualify elements.
To further qualify elements, you can use attributes. You can declare attributes
in an XML schema.
To declare an attribute, you can use the attribute element.
The attribute Element
You can declare an attribute in an XML schema by using the following syntax:
<attribute name = “attributename” ref = “attributename” type =
”datatypename” use = ”value” value =”value”> </attribute>
The attribute element contains attributes that are used to further qualify and
restrict the scope and use of a user-defined attribute.
The attributes of the attribute element are:
1. Name
2. Ref
3. Type
4. Use
The name Attribute
The name attribute is used to specify the name of a user-defined attribute.
This attribute must be used when the schema element is the parent element of
the attribute element.
The value of the name attribute cannot include the colon (:) symbol.
The ref Attribute
The ref attribute is used to refer to a user-defined attribute declared in the same
or any other XML schema.
You cannot use the name and ref attribute together in the attribute element.
The type Attribute
The type attribute takes a value that specifies the data type of a user-defined
attribute.
Example:
<xsd:attribute name = “ PRODUCTID” type = “xsd:string”>
The PRODUCTID attribute is declared.
The type attribute is set to string, which is a simple data type.
This ensures that a user can assign an alphanumeric value to the attribute.
Attributes can be associated with both built-in and user-defined simple types.
For example, to associate a user-defined simple type called myID with an
attribute called PRODID, you can use the following declaration statement:
<xsd:attribute name = “PRODID” type = “myID”>
In the preceding example,myID is a user-defined simple type, which is created
using the simple Type element.
The use Attribute
The use attribute specifies the way in which an attribute can be used in an
XML document.
The following example illustrates the use of the attribute element in an XML
schema:
<xsd:element name = “PRODUCT” type = “prod” />
<xsd:complexType name = “prod”>
<xsd:sequence>
<xsd:element name = “PRODUCTNAME” type = “xsd : string” />
<xsd:element name = “DESCRIPTION” type = “xsd : string” />
<xsd:element name = “PRICE” type = “xsd : positiveInteger” />
<xsd:element name = “QUANTILY” type = “xsd : Integer” />
</xsd : sequence>
<xsd:attribute name = “PRODID” type = “xsd : string” use =
“required”>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
An element called PRODUCT is declared. This element is associated with a
complex type called prod.
This complex type contains the declarations for the elements
PRODUCTNAME, DESCRIPTION, PRICE and QUANTITY
Global Attributes
You might need to use the same attribute for different elements.
For example, You have two elements, book and author in an XML document
and you want to use an attribute called name with both the elements
Global attribute are attributes that are declared outside all element
declaration.
Global attributes facilitate reusability of attributes. For such attribute, the
schema element is the parent element.
Example:
<xsd : schema>
<xsd : attribute name = “NAME” type = “xsd:string” />
</xsd : schema>
The NAME attribute is declared directly under the schema element.
Therefore, it is global attribute.
After declaring a global attribute, you can reuse this attribute from anywhere
within the schema.
Restricting values
Attribute are declared in an XML schema, values are assigned to attribute in
an XML document that conforms to the XML schema
You might need to ensure that the values assigned to attributes match a certain
pattern or contain one of the specified sets of values.
This information can be stated in the XML schema
To restrict the values that can be assigned to a user-defined attribute:
1. Declare the attribute and associate them with user-defined simple types.
2. Create the simple types by using the simpleType element.
3. Use the restrict element within the simpleType element.
Example:
<xsd:attribute name = “PRODID” type = “pID” use = “required”/>
<xsd:simpleType name = “pID”>
<xsd:restriction base = “xsd:string”>
<xsd:pattern value = “[p] {1} \d{3} “/>
</xsd:restriction>
</xsd:simpleType>
Using Attributes in an XML Schema
You have learned about the attribute element and the use of that element in an
XML schema.
Cybershopper sells two categories of products, books and toys.
The product details comprise the name of the product
To create an XML schema based on the details given in the scenario
You need to identify the elements and attributes of the XML schema
Element of the XML Document
Element Description
PRODUCTDATA Acts as the root element for all other element that are used
in the XML document
PRODUCT Represent the details (product name description, price and
quantity)for each product
PRODUCTNAME Represents the name of each product
DESCRIPTION Represents the description of each product
PRICE Represents the price of each product
QUANTITY Represents the available quantity of each product
To declare the elements and attributes required for storing products data type
the following code in Notepad and save it as product.xsd.
Element Description
CUSTOMERDATA Acts as the root for all other elements that are used in the
XML document.
CUSTOMER Represents the details (first name, last name, and contact
information) for each customer.
FIRSTNAME Represent the first name of a customer.
LASTNAME Represent the last name of a customer
CONTACTINFO Represents either residential or official contact
information for a customer.
RESIDENCE Represents the
ADDRESS Represents the address of either the residence or the
office of a customer. This element will be used as the child
element of the RESIDENCE and OFFICE elements.
OFFICE Represents the official contact information for a
customer. This element will be used as a child element of
CONTACTINFO.
PHONE Represents the phone number of the residence or the
office for a customer. This element will be used as a child
element of CONTACTINFO.
FILM {COLOR:RED}
MSXML parser
XSLT style sheet XSLT tree
XSLT
XSLT Result tree
processor
Processor
pppppppp
XSLT Elements
XSLT provides a number of elements for selecting and formatting data.
1. Stylesheet
2. Value-of
3. For-each
4. Sort
5. Text
The stylesheet Element
The XSLT style sheet contains instructions for transforming XML documents.
Therefore declaration is added in the XSLT file to instruct the browser that the
file is a style sheet file this declaration is known as style sheet declaration.
Syntax:
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSLT/Transform”
version = “1.0”>
The stylesheet is the root element for all XSLT stylesheets.
The xsl prefix contains a reference to the namespace URI for XSLT.
The value-of Element
The value-of element displays the value of the specified element or attribute.
Syntax:
<xsl:value-of select = “elementname/attributename” />
The value-of is an empty element, so you must include the “/” character before
the closing angular bracket of the tag.
For Example the value-of element to display the value of the
PRODUCTNAME element:
<xsl:value-of select = “@CATEGORY”>
If you want to display the value of an attribute, use the “@” symbol as a
prefix.
<xsl:value-of select = “@CATEGORY”>
In the preceding syntax the pattern can be any one of the following:
1. Element
2. Parent/child
3. Ancestor//child
Different patterns of the for-each Element
PATTERNS SYNTAX EXPLANATION
Element <xsl:for-each select = Performs the specified action for
“PRODUCT”> each occurrence of the PRODUCT
element
Parent/child <xsl:for-each select = Performs the specified action for
“PRODUCTDATA/PRODUCT” each occurrence of the PRODUCT
> element, having the
PRODUCTDATA element as its
parents
Ancestor//child <xsl: for-each match = Applies the action to the element
“PRODUCT//BRAND”> BRAND, having the PRODUCT
element as its ancestor
Example:
<xsl : for-each select = “PRODUCTDATA / PRODUCT”>
<font color = “blue”> <xsl : value-of select = “PRODUCTNAME”>
</font> <xsl:value-of select = “PRICE”/>
<xsl:for-each>
The sort Element
XSLT provides the sort element for sorting data based on values assigned to
elements and attributes.
The sort element does not have any child elements.
Syntax:
<xsl:sort select = “expression” order = “ascending | descendir.g”
Case-order = “upper-first | lower-first”
Data-type = “text|number|qname”/>
Attribute of the sort Element
select expression Represents the element name.
Order Ascending Represents the sort order. The default
descending sort order is ascending.
Case-order Upper-first lower-first Uppercase letters come before lowercase
letters or vice versa
Data-type Text The data type can be a number, a
Number fragment of text, or a user-defined data
Qname type. The default data type is text.
Example:
<xsl:for-each select =”PRODUCT”>
<xsl:sort select =”PRICE” data-type=”number” order =”ascending”/>
<xsl:value-of select = “PRODUCTNAME”/>
<xsl:value-of select =”COVER_COLOR”/>
</xsl:for-each>
The text Element
The text element allows you to generate constant texten the output
This element can be used to display labels
Syntax
<xsl:text> product Name : </xsl:text>
Example:
<xsl:stylesheet xmlns:xsl = “http://www.w3.org/1999/XSL/Transform” version
=”1.0”>
<xsl:template match = “/”>
<xsl:for-each select =”PRODUCTDATA/PRODUCT”>
<xsl:sort select =”PRICE” data-type=”number” order=”descending”/>
<xsl:text> Product Id: </xsl:text>
<xsl:value-of select =”@PRODID”/>
XSLT Template Rules
A template rule describes how an XML element and its contents are converted
into a format that can be displayed in the browser.
XSLT allows you to define template rules for the output.
A template rule consists
A pattern that identifies an element in an XML document.
Action or processing code that details the transformation and rendering of the
resulting element.
The template Element
The template element is used to define a template for the desired output.
Syntax
<xsl:template match = “pattern”>
[action to be taken]
</xsl:template>
Different values of pattern:
Pattern example
/ <xsl:template match = “/”>
. <xsl:template match = “.”>
element1 <xsl:template match = “customer”>
element1 | <xsl:template match = “firstname |
element2|…. lastname
element <xsl:template match =
[@attribute] “customer[@custid]”
Element <xsl:templatematch=
[@attribute = “customer[@custid=’1’]”>
‘value’]
Parent/child <xsl:templatematch=
“customer/firstname”>
Ancestor//child <xsl:templatematch=
“customerdetails//address”>