XSLT command [xml schema conversion] 1. cyclic xsl: for-each... xsl: for-eachselect = "BookList/Item" trthalign = "left" xsl: value-ofselect = ". // title "// thtdxsl: value-ofselect = ". // categ
XSLT command [xml format conversion]
1. Loop
2. sorting
3. Conditional processing Or Or
4. name template
,
,
5. numbering method
Xml document [Article. xml]
2897
[Share] tens of millions of paging stored procedures (with consequence demonstration)
Network
[Share] tens of millions of paging stored procedures (with consequence demonstration)
2006-02-27 18:29:53
7
/Web/Article/viewColumn. aspx? ColID = 19
19
SQL Server
1
Resource/SQL server/2006-02-27/20060227182953. htm
Network
2006-02-27 18:29:53
[Share] demonstration of the consequences of the tens of millions of paging stored procedures (with consequence demonstration:
Http://www.cn5135.com/_App/Opportunities/QueryResult.aspx
Create procedure CN5135_SP_Pagination
/*************************************** ***************************
Tens of millions of paging stored procedures
**************************************** ***************************
Parameter clarification:
1. Tables: table name, view
2. PrimaryKey: Important hazard
3. Sort: sorting statement without Order By such as NewsID Desc and OrderRows Asc
4. CurrentPage: current page number
5. PageSize: page size
6. Filter: Filter statement without Where
7. Group: Group statement without Group
Consequence demo: http://www.cn5135.com/_App/Opportunities/QueryResult.aspx
**************************************** ***********************/
(
@ Tables varchar (1000 ),
PrimaryKey varchar (100 ),
@ Sort varchar (200) = NULL,
@ CurrentPage int = 1,
@ PageSize int = 10,
@ Fields varchar (1000) = '*',
@ Filter varchar (1000) = NULL,
@ Group varchar (1000) = NULL
)
AS
/* Default sorting */
IF @ Sort is null or @ Sort =''
SET @ Sort = @ PrimaryKey
DECLARE @ SortTable varchar (100)
DECLARE @ SortName varchar (100)
DECLARE @ strSortColumn varchar (200)
> DECLARE @ operator char (2)
DECLARE @ type varchar (100)
DECLARE @ prec int
/* Set the sorting statement .*/
If charindex ('desc', @ Sort)> 0
BEGIN
SET @ strSortColumn = REPLACE (@ Sort, 'desc ','')
SET @ operator = '<='
END
ELSE
BEGIN
If charindex ('asc ', @ Sort) = 0
SET @ strSortColumn = REPLACE (@ Sort, 'asc ','')
SET @ operator = '> ='
END
If charindex ('.', @ strSortColumn)> 0
BEGIN
SET @ SortTable = SUBSTRING (@ strSortColumn, 0, CHARINDEX ('.', @ strSortColumn ))
SET @ SortName = SUBSTRING (@ strSortColumn, CHARINDEX ('.', @ strSortColumn) 1, LEN (@ strSortColumn ))
END
ELSE
BEGIN
SET @ SortTable = @ Tables
SET @ SortName = @ strSortColumn
END
SELECT @ type = t. name, @ prec = c. prec
FROM sysobjects o
JOIN syscolumns c on o. id = c. id
JOIN policypes t on c. xusertype = t. xusertype
WHERE o. name = @ SortTable AND c. name = @ SortName
If charindex ('char ', @ type)> 0
SET @ type = @ type '('cast (@ prec AS varchar )')'
DECLARE @ strPageSize varchar (50)
DECLARE @ strStartRow varchar (50)
DECLARE @ strFilter varchar (1000)
DECLARE @ strSimpleFilter varchar (1000)
DECLARE @ strGroup varchar (1000)
/* Default current page */
IF @ CurrentPage <1
SET @ CurrentPage = 1
/* Set paging parameters .*/
SET @ strPageSize = CAST (@ PageSize AS varchar (50 ))
SET @ strStartRow = CAST (@ CurrentPage-1) * @ PageSize 1) AS varchar (50 ))
/* Filter and group statement .*/
IF @ Filter is not null and @ Filter! =''
BEGIN
SET @ strFilter = 'where' @ filter''
SET @ strSimpleFilter = 'and' @ filter''
END
ELSE
BEGIN
SET @ strSimpleFilter =''
SET @ strFilter =''
END
IF @ Group is not null and @ Group! =''
SET @ strGroup = 'group by' @ group''
ELSE
SET @ strGroup =''
/* Execute the query statement */
EXEC (
'
DECLARE @ SortColumn '@ type'
Set rowcount '@ strstartrow'
SELECT @ SortColumn = '@ strSortColumn' FROM '@ Tables @ strfilter''
@ StrGroup 'Order by' @ Sort'
Set rowcount '@ strPageSize'
SELECT '@ Fields' FROM '@ Tables 'where' @ strSortColumn @ operator
'@ SortColumn' @ strsimplefilter' '@ strGroup 'Order by' @ Sort'
'
)
GO
Visitor
OK!
Visitors
Good
Dream
Good!
Dream 3
Look
Try again
Peterzb
Xslt document [Article. xsl]
<BR> <xsl: value-of select = 'articles/Article/title'/> <BR>