Regular Expression using XSLT
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Mon Jul 23, 2007 3:59 pm
Regular Expression using XSLT
Post by ankitbhurat »
Hello every1
I am using ASP.NET 1.1 ,
I have a problem task in which i have to search employees whose first names start with 'A' to 'G'.
e.g.
ABC
CF
Ef
FF
GH
I have data in my XML.
Any solution hint will also do,
Many thanks in advance.
Ankit
I am using ASP.NET 1.1 ,
I have a problem task in which i have to search employees whose first names start with 'A' to 'G'.
e.g.
ABC
CF
Ef
FF
GH
I have data in my XML.
Any solution hint will also do,
Many thanks in advance.
Ankit
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
The regular expression for names that start with A - G is ^[A-G]\w+ but using it in the XSLT stylesheet depends on the structure of the input XML document. For example if you must process only elements with employees having names starting with A - G in an XML file like:
then you can use in the XSLT stylesheet:
Regards,
Sorin
The regular expression for names that start with A - G is ^[A-G]\w+ but using it in the XSLT stylesheet depends on the structure of the input XML document. For example if you must process only elements with employees having names starting with A - G in an XML file like:
Code: Select all
<all>
<emp id="emp01">
<first_name>FirstName</first_name>
<last_name>LastName</last_name>
</emp>
...
</all>
Code: Select all
<xsl:template match="emp[matches(first_name, '^[A-G]\w+')]">
...
</xsl:template>
Sorin
Last edited by sorin_ristache on Tue Jul 24, 2007 1:32 pm, edited 1 time in total.
-
- Posts: 3
- Joined: Mon Jul 23, 2007 3:59 pm
Thanks, will this work for 1.0 alos ?
Post by ankitbhurat »
Thanks Sorin
for ur inputs ..
I am rather new to XSLT... Just wanted to know if this wil work for version 1.0 also ?.
Many THanks
for ur inputs ..
I am rather new to XSLT... Just wanted to know if this wil work for version 1.0 also ?.
Many THanks
sorin wrote:Hello,
The regular expression for names that start with A - G is [A-G]\w+ but using it in the XSLT stylesheet depends on the structure of the input XML document. For example if you must process only elements with employees having names starting with A - G in an XML file like:
then you can use in the XSLT stylesheet:Code: Select all
<all>
<emp id="emp01">
<first_name>FirstName</first_name>
<last_name>LastName</last_name>
</emp>
...
</all>
Regards,Code: Select all
<xsl:template match="emp[matches(first_name, '^[A-G]\w+')]">
...
</xsl:template>
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
In XSLT 1.0 you can use for example the regular expression module of the EXSLT library.
Regards,
Sorin
Regards,
Sorin
Last edited by sorin_ristache on Tue Jul 24, 2007 2:39 pm, edited 1 time in total.
-
- Posts: 3
- Joined: Mon Jul 23, 2007 3:59 pm
Thanks
Post by ankitbhurat »
Thanks,
I have downloaded the ZIP file. Wil let you know if I face any problem.
Please selected the option "Notify me when a reply is posted", so that you are keep informed.
Ankit
I have downloaded the ZIP file. Wil let you know if I face any problem.
Please selected the option "Notify me when a reply is posted", so that you are keep informed.
Ankit
sorin wrote:In XSLT 1.0 you can use for example the regular expression part of the EXSLT library.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service